client/addons/garage/functions/fnc_storeVehicle.sqf
2025-01-04 19:26:35 -06:00

52 lines
1.4 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 _vehType = _data select 0;
private _className = _data select 1;
private _netID = _data select 2;
// private _netID = _data select 3;
private _veh = objectFromNetId _netID;
// private _hitPointsData = getAllHitPointsDamage _veh;
// private _vehData = [
// fuel _veh,
// damage _veh,
// str _hitPointsData
// ];
// private _garage = player getVariable ["FORGE_Garage", []];
private _garage = GETVAR(player,FORGE_Garage,[]);
// _garage pushBack [_vehType, _className, _vehData];
_garage pushBack [_vehType, _className];
// 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";