client/addons/arsenal/functions/fnc_addGarageVehicle.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

42 lines
944 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Adds vehicle to player's garage unlocks and updates virtual garage
*
* Arguments:
* 0: Classname of vehicle to add <STRING>
* 1: Type of vehicle to add <STRING>
*
* Return Value:
* None
*
* Examples:
* ["B_T_LSV_01_unarmed_F", "car"] call forge_client_arsenal_fnc_addGarageVehicle
*
* Public: Yes
*/
params [["_class", "", [""]], ["_type", "", [""]]];
private _garage_unlocks = GETVAR(player,Garage_Unlocks,GVAR(default_garage));
private _typeToNumber = switch (_type) do {
case "car": {0};
case "armor": {1};
case "heli": {2};
case "plane": {3};
case "naval": {4};
case "static": {5};
default {0};
};
private _index = (_garage_unlocks select _typeToNumber) pushBackUnique _class;
if (_index > -1) then {
SETPVAR(player,Garage_Unlocks,_garage_unlocks);
[[_class]] call FUNC(addVirtualVehicles);
true
} else {
false
};