fn_getUserMarkerList.sqf 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Name: cTab_fnc_getUserMarkerList
  3. Author(s):
  4. Gundy
  5. Description:
  6. Issued from a client: Send command to server to receive the current user marker list
  7. Issued on the server: Send userMarkerList back to client
  8. Parameters:
  9. To send request to server
  10. NONE
  11. When server is receiving request from server
  12. 0: OBJECT - Object local to client that is requesting
  13. When client is receiving the list
  14. 0: ARRAY - Current user marker list
  15. 1: INTEGER - Current transaction ID
  16. Returns:
  17. BOOLEAN - TRUE
  18. Example:
  19. // Client requesting the list from the server
  20. [player] call cTab_fnc_getUserMarkerList;
  21. // Client receiving the list from the server
  22. [[userMarkerList],157] call cTab_fnc_getUserMarkerList;
  23. */
  24. private [];
  25. call {
  26. // Send request to Server
  27. if (count _this == 0) exitWith {
  28. if (hasInterface && !isServer) then {
  29. [[player],"cTab_fnc_getUserMarkerList",false,false,true] call bis_fnc_MP;
  30. };
  31. };
  32. // Request received by the server to send the current list, make sure its not a client at the same time
  33. // Only send the list if the transaction ID is not at its initial value, meaning the list is likely to have some meaningful data
  34. if (count _this == 1) exitWith {
  35. if (isServer && !hasInterface && (cTab_userMarkerTransactionId >= 0)) then {
  36. [[cTab_userMarkerLists,cTab_userMarkerTransactionId],"cTab_fnc_getUserMarkerList",_this select 0,false,true] call bis_fnc_MP;
  37. };
  38. };
  39. // Otherwise this is the list and transaction ID received by the client
  40. cTab_userMarkerLists = _this select 0;
  41. cTab_userMarkerTransactionId = _this select 1;
  42. if (hasInterface) then {call cTab_fnc_updateUserMarkerList;};
  43. };
  44. true