client/addons/store/functions/fnc_buyVehicle.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

34 lines
1009 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Purchases a vehicle and adds it to the player's garage
*
* Arguments:
* 0: Class Name <STRING> - The classname of the vehicle to purchase
* 1: Price <NUMBER> - The price of the vehicle
* 2: Vehicle Type <STRING> - The type of vehicle ("car", "armor", "heli", "plane", "naval", "static")
*
* Return Value:
* None
*
* Example:
* ["B_APC_Tracked_01_rcws_F", 5000, "tank"] call forge_store_fnc_buyVehicle
*
* Public: No
*/
params ["_className", "_price", "_vehicleType"];
private _displayName = getText (configFile >> "CfgVehicles" >> _className >> "displayName");
private _garage = GETVAR(player,FORGE_Garage,[]);
if !([_price] call FUNC(handlePurchase)) exitWith {};
_garage pushBack [_vehicleType, _className];
SETPVAR(player,FORGE_Garage,_garage);
[_className, _vehicleType] call EFUNC(arsenal,addGarageVehicle);
[format ["You have purchased %1 for $%2.", _displayName, _price], "info", 3, "right"] call EFUNC(misc,notify);