Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. -- anti fast warp
  2. -- if a player rejoins too soon after disconnecting then they are trying to
  3. -- fast-warp back to the station and should have their inventory confiscated
  4.  
  5. local fastwarptime = 60
  6.  
  7. hook.Add("ShutDown", 'sunrise_nofastwarp', function()
  8.     for _, pl in pairs(player.GetAll()) do
  9.         file.Write("sunrise/"..pl:UniqueID()..".txt", tostring(os.time()))
  10.     end
  11. end)
  12.  
  13. hook.Add("PlayerDisconnect", 'sunrise_nofastwarp', function(pl)
  14.     file.Write("sunrise/"..pl:UniqueID()..".txt", tostring(os.time()))
  15. end)
  16. hook.Add("PlayerInitialSpawn", 'sunrise_nofastwarp', function(pl)
  17.     if file.Exists("sunrise/"..pl:UniqueID()..".txt") then
  18.         local leavetime=tonumber(file.Read("sunrise/"..pl:UniqueID()..".txt"))
  19.         if os.time() <= (leavetime + fastwarptime) then
  20.             timer.Simple(1, pl.Kill, pl) -- or something similar
  21.         end
  22.     end
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement