client/addons/garage/functions/fnc_storeVehicle.sqf
Jacob Schmidt c6daf95415
All checks were successful
Build / Build (push) Successful in 53s
Initial Repo Setup
2025-01-01 14:35:12 -06:00

49 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
private _display = findDisplay IDD_GARAGEDIALOG;
private _garageList = _display displayCtrl IDC_GARAGEVEHICLELIST;
private _vehicleList = _display displayCtrl IDC_VEHICLELIST;
private _selectedVehicle = lbCurSel _vehicleList;
private _selectedVehicleData = _vehicleList lbData _selectedVehicle;
private _data = call compile _selectedVehicleData;
ctrlEnable [IDC_STOREBUTTON, false];
if ((isNil { _data })) exitWith { ctrlEnable [IDC_STOREBUTTON, true]; };
private _isGarageVehicle = _data select 0;
private _className = _data select 1;
private _netID = _data select 3;
private _veh = objectFromNetId _netID;
private _vehData = [
getAllHitPointsDamage _veh,
fuel _veh,
damage _veh
];
// private _garage = player getVariable ["FORGE_Garage", []];
private _garage = GETVAR(player,FORGE_Garage,[]);
_garage pushBack [_isGarageVehicle, _className, _vehData];
// player setVariable ["FORGE_Garage", _garage, true];
SETPVAR(player,FORGE_Garage,_garage);
lbClear _vehicleList;
lbClear _garageList;
_vehicleList lbSetCurSel -1;
_garageList lbSetCurSel -1;
_veh spawn {
deleteVehicle _this;
waitUntil { isNull _this };
sleep 0.5;
[] call FUNC(fetchGarage);
[] call FUNC(fetchNearby);
ctrlEnable [IDC_STOREBUTTON, true];
};
playSound "FD_Finish_F";