SHARE
TWEET

Untitled

a guest Aug 25th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "\life_server\script_macros.hpp"
  2. /*
  3.     File: fn_getVehicles.sqf
  4.     Author: Bryan "Tonic" Boardwine
  5.  
  6.     Description:
  7.     Sends a request to query the database information and returns vehicles.
  8. */
  9. private ["_pid","_side","_type","_unit","_ret","_tickTime","_queryResult"];
  10. _pid = [_this,0,"",[""]] call BIS_fnc_param;
  11. _side = [_this,1,sideUnknown,[west]] call BIS_fnc_param;
  12. _type = [_this,2,"",[""]] call BIS_fnc_param;
  13. _unit = [_this,3,objNull,[objNull]] call BIS_fnc_param;
  14.  
  15. //Error checks
  16. if (_pid isEqualTo "" || _side isEqualTo sideUnknown || _type isEqualTo "" || isNull _unit) exitWith {
  17.     if (!isNull _unit) then {
  18.         [[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
  19.     };
  20. };
  21.  
  22. _unit = owner _unit;
  23. _side = switch (_side) do {
  24.     case west:{"cop"};
  25.     case civilian: {"civ"};
  26.     case independent: {"med"};
  27.     case east: {"justiz"};
  28.     default {"Error"};
  29. };
  30.  
  31. if (_side == "Error") exitWith {
  32.     [[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
  33. };
  34. _query = format ["SELECT id, side, classname, type, pid, alive, active, plate, color, immatriculation, insure FROM vehicles WHERE pid='%1' AND alive='1' AND fourriere='0' AND active='0' AND side='%2' AND type='%3'",_pid,_side,_type];
  35.  
  36. _tickTime = diag_tickTime;
  37. _queryResult = [_query,2,true] call DB_fnc_asyncCall;
  38.  
  39. if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
  40.     diag_log "------------- Client Query Request -------------";
  41.     diag_log format ["QUERY: %1",_query];
  42.     diag_log format ["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
  43.     diag_log format ["Result: %1",_queryResult];
  44.     diag_log "------------------------------------------------";
  45. };
  46.  
  47. if (_queryResult isEqualType "") exitWith {
  48.     [[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
  49. };
  50.  
  51. [_queryResult] remoteExec ["life_fnc_impoundMenu",_unit];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top