Just
s.lua
function kickPing() -- Creates a function called kickPing
for i, player in ipairs(getElementsByType("player")) do -- Loop every player
if (getPlayerPing(player) >= 500) then -- If their ping is over 500
kickPlayer(player, "Ping over 500!") -- Kick them
end
end
end
setTimer(kickPing, 5000, 0) -- Every 5 seconds, the kickPing function is called.
c.lua
function checkPing()
local ping = getPlayerPing(getLocalPlayer()) -- get the ping from the source element (the player who joined)
if (ping > 100) then -- if it's higher than 100...
outputChatBox("Your ping is pretty high! Please try to lower it if possible.") -- output a message to the player
end
end
addCommandHandler("ping", checkPing)
//Source:https://wiki.multitheftauto.com/wiki/GetPlayerPing