- warned = {} -- don't touch this
- max_ping = 800 --How high the ping of the player should be before you kick them.
- pingkick_timeout = 5 --After this many minutes any player warned of high ping will be forgotten.
- warn_players = true -- Will warn everyone in the server if someone is getting kicked for high ping.
- function GetRequiredVersion()
- return 10058
- end
- function OnScriptLoad(process)
- registertimer(600000, "remindTimer")
- registertimer(18000, "pingkickTimer")
- registertimer(pingkick_timeout * 60000, "pingTimeout")
- end
- function OnScriptUnload()
- end
- function OnNewGame(map)
- end
- function OnGameEnd(mode)
- end
- function OnServerChat(player, chattype, message)
- return 1
- end
- function OnServerCommand(player, command)
- t = {}
- local count = gettokencount(command, " ")
- local response = 1
- for i=1,count do
- local word = gettoken(command, " ", i - 1)
- word = string.lower(word:gsub('"', ""))
- table.insert(t, word)
- end
- if t[1] == "ping_kick" or t[1] == "pingkick" or t[1] == "sv_pingkick" or t[1] == "sv_setpingmax" then
- response = 0
- if count == 2 then
- max_ping = tonumber(t[2])
- hprintf("Max Ping set to " .. t[2])
- else
- hprintf("Invalid Syntax: sv_pingkick [maxping]")
- end
- end
- return response
- end
- function OnTeamDecision(cur_team)
- return dest_team
- end
- function OnPlayerJoin(player, team)
- end
- function OnPlayerLeave(player, team)
- end
- function OnPlayerKill(killer, victim, mode)
- end
- function OnKillMultiplier(player, multiplier)
- end
- function OnPlayerSpawn(player, m_objectId)
- end
- function OnPlayerSpawnEnd(player, m_objectId)
- end
- function OnTeamChange(relevant, player, team, dest_team)
- return 1
- end
- function OnClientUpdate(player, m_objectId)
- end
- function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
- return 1
- end
- function OnWeaponReload(player, weapon)
- return 1
- end
- function OnVehicleEntry(relevant, player, vehicleId, vehicle_tag, seat)
- return 1
- end
- function OnVehicleEject(player, forceEject)
- return 1
- end
- function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
- end
- function OnWeaponAssignment(player, object, count, tag)
- end
- function OnObjectCreation(m_objectId, player_owner, tag)
- end
- function remindTimer(id, count)
- say("This server is equipped with Ping Kick")
- say("If your ping is over " .. max_ping .. " then you will be kicked!")
- return 1
- end
- function pingTimeout(id, count)
- for i = 0,15 do
- if getplayer(i) ~= nil then
- warned[gethash(i)] = nil
- end
- end
- end
- function pingkickTimer(id, count)
- for i = 0,15 do
- local m_player = getplayer(i)
- if m_player ~= nil then
- local player_ping = readword(m_player, 0xDC)
- if player_ping > max_ping then
- if warned[gethash(i)] ~= nil then
- svcmd("sv_kick " .. resolveplayer(i))
- say(getname(i) .. " was kicked for: Ping over " .. max_ping)
- else
- warned[gethash(i)] = true
- say("WARNING! " .. getname(i) .. " will be kicked for: Ping over " .. max_ping)
- end
- end
- end
- end
- return 1
- end
Recent Pastes