LucasRed

Untitled

Mar 30th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. PSaves <- [];
  2.  
  3. function onPlayerJoin( player )
  4. {
  5.     PSaves.push( { ID = player.ID, LastSave = time() } );
  6. }
  7.  
  8. function onPlayerPart( player, reason )
  9. {
  10.     PSaves.remove( PSaves.find( player.Name ) );
  11. }
  12.  
  13. function SavePlayerData()
  14. {
  15.     foreach( idx, val in PSaves )
  16.     {
  17.         if ( ( time() - val.LastSave ) == 180 )
  18.         {
  19.             local player = FindPlayer( val.ID );
  20.             if ( player )
  21.             {
  22.                 // save...
  23.                 val.LastSave = time();
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment