Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  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. default {"Error"};
  28. };
  29.  
  30. if (_side == "Error") exitWith {
  31. [[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
  32. };
  33.  
  34. _query = format ["SELECT id, side, classname, type, pid, alive, active, plate, color, immatriculation FROM vehicles WHERE pid='%1' AND alive='1' AND entreprise_id='0' AND active='0' AND side='%2' AND type='%3'",_pid,_side,_type];
  35.  
  36.  
  37. _tickTime = diag_tickTime;
  38. _queryResult = [_query,2,true] call DB_fnc_asyncCall;
  39.  
  40. if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
  41. diag_log "------------- Client Query Request -------------";
  42. diag_log format ["QUERY: %1",_query];
  43. diag_log format ["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
  44. diag_log format ["Result: %1",_queryResult];
  45. diag_log "------------------------------------------------";
  46. };
  47.  
  48. if (_queryResult isEqualType "") exitWith {
  49. [[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
  50. };
  51.  
  52. [_queryResult] remoteExec ["life_fnc_impoundMenu",_unit];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement