- Documentation
- Shared functions
- getPlayerPing
Function
getPlayerPing
Returns the player's ping in milliseconds.
Syntax
int getPlayerPing(player thePlayer)Arguments
thePlayerplayer- The player.
Returns
The ping.
Example
setTimer(function()
for _, p in ipairs(getElementsByType("player")) do
if getPlayerPing(p) > 500 then
kickPlayer(p, "Za wysoki ping")
end
end
end, 15000, 0)
Notes
Client. Works in a client script too: your own ping is measured by the client, other players' pings come from the server (the first call asks for everyone's pings, then refreshed every 2 s while the script keeps asking; 0 until then).