GetPlayerPing

From SA-MP

Jump to: navigation, search


GetPlayerPing

You can use this function to get the current ping of a user.


(playerid)
playeridThe playerid who's ping you want to check.
This function returns the current ping of the player (expressed in milliseconds).


stock CheckPing(playerid)
{
    //Get the player's ping and kick if it's excessive
    new ping = GetPlayerPing(playerid);
 
    if(ping > 1000) {
        Kick(playerid);
    }
}

Note: It is not recommended to kick a user after only a single ping infraction. Pings may spike occasionally (especially when a player connects) and cause good players to be kicked.

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

  • GetPlayerName: Gets a players name and stores it in a variable.
Personal tools