Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. function GM:PlayerDisconnected ( Player )
  2.     Player:Save();
  3.    
  4.     // Remove their save timer
  5.     local ourID = Player:SteamID();
  6.     timer.Remove(ourID);
  7.    
  8.     // Remove their properties
  9.     for k, v in pairs(PROPERTY_DATABASE) do
  10.         local propOwner = GetGlobalEntity("p_" .. k);
  11.        
  12.         if (propOwner && IsValid(propOwner) && propOwner == Player) then
  13.             SetGlobalEntity("p_" .. k, Entity());
  14.         end
  15.     end
  16.    
  17.     // Delete all of their props
  18.     for k, v in pairs(ents.GetAll()) do
  19.         if (v.Owner && v.Owner == Player) then
  20.             v:Remove();
  21.         end
  22.        
  23.         if (v.pickupPlayer && v.pickupPlayer == Player) then
  24.             v:Remove();
  25.         end
  26.     end
  27.    
  28.     // Remove their vehicle (and rotators)
  29.     Player:RemoveCar();
  30.    
  31.     // Make sure they're not on the phone with anyone
  32.     if (Player.Calling) then DropCall(Player); end
  33.    
  34.     timer.Simple(1, self.PushNumPlayers);
  35. end
  36.  
  37. function GM:ShutDown ( )
  38.     for k, v in pairs(player.GetAll()) do
  39.         v:Save();
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement