client/addons/store/functions/fnc_buyVehicle.sqf
Jacob Schmidt 69f8f037df
All checks were successful
Build / Build (push) Successful in 28s
refactor: Remove tasks.json and update documentation in store functions
This commit removes the `tasks.json` file from the `.vscode` directory. Additionally, it enhances the documentation in `fnc_buyItem.sqf` and `fnc_buyVehicle.sqf` by providing clearer descriptions of item and vehicle types. The `fnc_handlePurchase.sqf` has also been updated to improve variable scoping for better code clarity.
2025-04-19 11:12:53 -05:00

37 lines
1.0 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Function: forge_store_fnc_buyVehicle
* Author: J. Schmidt
*
* Description:
* 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);