IsPlayerConnected

From SA-MP Wiki

Jump to: navigation, search


Tip

Image:Light_bulb_icon.png

This function can be omitted in a lot of cases. Many other functions already have some sort of connection check built in.


Description:

Checks if a player is connected (if an ID is taken by a connected player).


Parameters:
(playerid)
playeridThe ID of the player to check.


Return Values:

  • 0: Player is NOT connected.
  • 1: Player IS connected.


Example Usage:

KillPlayer(playerid)
{
    if(!IsPlayerConnected(playerid)) printf("Player ID %i is not connected!", playerid);
    else SetPlayerHealth(playerid, 0);
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.


Related Callbacks

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

In other languages