Advertisement
InnovativeStudios

fn_switchGarage.sqf

Jan 26th, 2023
1,712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 0.90 KB | None | 0 0
  1. /*
  2.     File : fn_switchGarage.sqf
  3.     Module: Garage
  4.     Author: Dardo
  5.     Description:
  6.     Change current status of vehicle,or set it to the wanted one
  7.    
  8.     Arguments:
  9.         1 - Key string
  10.         2 - Stored/Took (Optional<Bool>)
  11. */
  12. params [["_key","",[""]],["_inGarage",nil,[false]]];
  13. if (_key == "") exitWith {};
  14.  
  15.  
  16. _parseBool = {
  17.   params ["_int"];
  18.   if (_int isEqualTo 0) exitWith {
  19.       false
  20.   };
  21.     if (_int isEqualTo 1) exitWith {
  22.       true
  23.   };  
  24.     false
  25. };
  26.  
  27. if (isNil "_inGarage") then {
  28.     //We want to change vehicle's status from the current one
  29.     _inGarage = [0, (format["getVehicleStatus:%1", _key])] call ExternalS_fnc_ExtDBquery;
  30.     _inGarage = [_inGarage] call _parseBool;
  31.     _inGarage = !_inGarage
  32. };
  33.  
  34. private _futureStatus = parseNumber _inGarage;
  35.  
  36. //Update status
  37. [0, (format["updateVehicle:%1:%2",_futureStatus,_key])] call ExternalS_fnc_ExtDBquery;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement