ACE3/addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf
Glowbal b489750d5b Minor optimizations using private, params, and isEqualType (#4323)
* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
2016-09-04 16:44:22 +02:00

29 lines
732 B
Plaintext

/*
* Author: PabstMirror
* On the server: Adds a key (magazineDetail name) to approved keys for a vehicle.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Magazine Name <STRING>
*
* Return Value:
* None
*
* Example:
* [tank1, "someMagainze [id xx:yy]"] call ACE_VehicleLock_fnc_serverSetupCustomKeyEH
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_veh", "_key"];
TRACE_2("params",_veh,_key);
if (!isServer) exitWith {ERROR("only run on server");};
if (isNull _veh) exitWith {ERROR("null vehicle");};
if (_key == "") exitWith {ERROR("empty key string");};
private _currentKeys = _veh getVariable [QGVAR(customKeys), []];
_currentKeys pushBack _key;
_veh setVariable [QGVAR(customKeys), _currentKeys, true];