File: ping_kick.lua - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

01: PLUGIN_NAME = "Ping kick"
02: PLUGIN_AUTHOR = "Baruch" -- hlepouse@gmail.com
03: PLUGIN_VERSION = "29 dec 2012"
04: 
05: include("ac_server")
06: 
07: lagtimes = {}
08: lagduration = 2 -- time before getting kicked (in seconds), change it if you want
09: pinglimit = 5 -- change it if you want
10: 
11: function LuaLoop()
12:     for cn = 0, maxclient() - 1 do
13:         if isconnected(cn) then
14:             if getping(cn) >= pinglimit then
15:                 clientprint(-1, getping(cn))
16:                 lagtimes[cn] = getsvtick()
17:             end
18:         end
19:     end
20:     for cn, time in ipairs(lagtimes) do
21:         if getsvtick() - time >= lagduration * 1000 then
22:                 clientprint(-1,cn)
23:             lagtimes[cn] = nil
24:             clientprint(-1, string.format("\f2 [SERVER INFO] \f1 Player \f2%s \f1was kicked for lagging", getname(cn)))
25:             disconnect(cn, DISC_NONE)
26:         end
27:     end
28: end