[REQ] L.U.A. Ping kicker?

Hello everyone!
I am looking for a simple L.U.A. code that will automatically kick a player it his/her
ping goes above a certain number. I have ULX and UliB Admin mods if you can make
it so that it announces the kick. I would really appreciate this!


Why would this be necessary? it’s just going to piss some people off?

Yeah I’m going to have to agree with Tyler, there’s really no reason to kick players for this.

(you know their ping doesn’t affect other players, right? this may be a silly statement if you already know this but I’ve encountered an incredible amount of people who think otherwise)

Over my experience of running a server, I understand that players who try and use mods, hacks, and boosters have a significantly increased ping. People who use cheat engine for example, tend to have a higher pingrate and average for obvious reasons. With my sandbox server, I encounter many people with high ping, and obvious mods and hacks. The ping kick not only stops that, but also keeps server performance up.

this is probably one of the dumbest things i’ve read on this forum

Hacks, mods and cheat engines don’t increase ping, distance and shitty connections do. A player’s latency has nothing to do with server performance…

Here you go:

[lua]local pinglimit=150

for _,pl in pairs(player.GetAll()) do
if pl:Ping()>pinglimit then
pl:Kick(“high ping auto-kick”)

In addition to the “cheaters”, you’re going to lose any players with a slow connection or p2p programs running.

Well, you can leave.

[editline]28th February 2013[/editline]

Thank you, sir.

Also, I hope you all know I intend to set the ping limit HIGH. I’m not oblivious to the fact that some people have slower connections.

There are a few problems you should consider before adding this script:

  • If the server’s connection get a small “bump” it will kick everyone off.
  • Even the smallest attack (DoS, DDoS), will make the server unplayable as it will kick everyone off.
  • If an client get a “lag-spike” for at least 5 seconds … he’ll be kicked.

If I should have a ping-limit on my server, it should be based on the average-ping.
Something like this:
local MinPingLimit=150 // Minimum limit
local PingKickAfter = 20 //seconds
local Warning = {}

local PingLimit = MinPingLimit

local Ping = 0
local N = 0
for _,pl in pairs(player.GetAll()) do
N = N+1
Ping = Ping + pl:Ping()
if N<2 then //No people or just 1 person on the server.
PingLimit = MinPingLimit
PingLimit = math.max(MinPingLimit, math.floor(Ping/N))

for _,pl in pairs(player.GetAll()) do
if pl:Ping()>PingLimit*1.2 then //We don’t want a few diggits over limit to tricker a kick. 20% should do it.
if Warning[pl:SteamID( )]==nil then
pl:PrintMessage( HUD_PRINTTALK, “[Warning!]: Your ping is too high. You might get kicked in a few seconds.” )
Warning[pl:SteamID( )] = PingKickAfter
Warning[pl:SteamID( )] = Warning[pl:SteamID( )]-5
if Warning[pl:SteamID( )]<1 then
pl:Kick(“Sorry. Too high ping D:”)
elseif(Warning[pl:SteamID( )]!=nil and pl:Ping()<PingLimit) then
Warning[pl:SteamID( )] = nil //You Ping is okay … just keep playing. :smiley:
pl:PrintMessage( HUD_PRINTTALK, “[Warning!]: Your ping is restored. Just keep playing :D” )

Okay, so my statement remains, ping doesn’t affect ANYTHING except for how smooth gameplay is for that player.

If you want to “prevent hacks” (ie. speedhacking) then you should be using the future ticks convar. With your idea I can’t download something while playing without being kicked from your server.

-Snip nvm. Forgot you’ll “freeze” when the ping is too high-