Guest User

Untitled

a guest
Feb 5th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. /*
  2. File : fn_getPlayTime.sqf
  3. Author : NiiRoZz
  4.  
  5. Description :
  6. Gets playtime for player with UID
  7.  
  8. GATHERED - Loaded from DB and NOT changed
  9. JOIN - Time, the player joined - the newly gathered playtime will be calculated using difference
  10.  
  11. */
  12.  
  13. private["_uid", "_time_gathered", "_time_join","_time"];
  14.  
  15. _uid = _this select 0;
  16. _time_gathered = nil;
  17. _time_join = nil;
  18.  
  19. {
  20. if ((_x select 0) isEqualTo _uid) exitWith {
  21. _time_gathered = _x select 1;
  22. _time_join = _x select 2;
  23. };
  24. } forEach TON_fnc_playtime_values;
  25.  
  26. if (isNil "_time_gathered" || isNil "_time_join") then {
  27. _time_gathered = 0;
  28. _time_join = time;
  29. TON_fnc_playtime_values pushBack [_uid, _time_gathered, _time_join];
  30. };
  31.  
  32. publicVariable "TON_fnc_playtime_values";
  33.  
  34. _time = (time - _time_join); //return time
  35. _time = _time + _time_gathered;
  36. _time = round (_time/60);
  37.  
  38. _time;
Add Comment
Please, Sign In to add comment