Advertisement
Rawoas13

No guests

May 3rd, 2020
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. -- no guests function created by Villaaam#0000
  2. local killAllGuests
  3. do
  4.     local guests = { }
  5.     local free = { }
  6.  
  7.     local currentTime = os.time()
  8.     local fiveDays = 1000 * 60 * 60 * 24 * 5 -- ms * s * m * h * d
  9.  
  10.     local sub = string.sub
  11.  
  12.     local isGuest = function(playerName, playerData)
  13.         return
  14.             sub(playerName, 1, 1) == '*' or
  15.             (currentTime - playerData.registrationDate) < fiveDays
  16.     end
  17.  
  18.     local killPlayer = tfm.exec.killPlayer
  19.     local tfmRoom = tfm.get.room
  20.  
  21.     killAllGuests = function()
  22.         for playerName, playerData in next, tfmRoom.playerList do
  23.             if guests[playerName] then
  24.                 killPlayer(playerName)
  25.             elseif not free[playerName] then
  26.                 if isGuest(playerName, playerData) then
  27.                     guests[playerName] = true
  28.                     killPlayer(playerName)
  29.                 else
  30.                     free[playerName] = true
  31.                 end
  32.             end
  33.         end
  34.  
  35.         return free, guests
  36.     end
  37. end
  38.  
  39. function eventNewGame()
  40.     killAllGuests()
  41.  
  42.     if gameStarted then
  43.         currentMap = tostring(tfm.get.room.currentMap)
  44.         setTimeMode()
  45.         for n,p in pairs(tfm.get.room.playerList) do
  46.             if not PlayerInTeam(n) then
  47.                 tfm.exec.killPlayer(n)
  48.             end
  49.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement