Guest User

Untitled

a guest
Jan 22nd, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. function onThink(interval, lastExecution, thinkInterval)
  2. local _ip = nil
  3. _ip = tonumber()
  4. if(not _ip or _ip == 0) then
  5. local revertIp = doRevertIp()
  6. if(not revertIp) then
  7. local tid = getPlayerByNameWildcard()
  8. if(not tid) then
  9. _ip = nil
  10. else
  11. _ip = getPlayerIp(tid)
  12. end
  13. else
  14. _ip = doConvertIpToInteger(revertIp)
  15. end
  16. end
  17. end
  18.  
  19. local list, ips = {}, {}
  20. local players = getPlayersOnline()
  21. for i, pid in ipairs(players) do
  22. local ip = getPlayerIp(pid)
  23. local tmp = table.find(ips, ip)
  24. if(tmp ~= nil and (not _ip or _ip == ip)) then
  25. if(table.countElements(list, ip) == 0) then
  26. list[players[tmp]] = ip
  27. end
  28.  
  29. list[pid] = ip
  30. end
  31.  
  32. table.insert(ips, ip)
  33. end
  34.  
  35. if(table.maxn(list) > 0) then
  36. for pid, ip in pairs(list) do
  37. doRemoveCreature(pid)
  38. doBroadcastMessage("Players with the same IP have been kicked!", MESSAGE_STATUS_WARNING)
  39. end
  40. return true
  41. end
Add Comment
Please, Sign In to add comment