IsPlayerConnected
From SA-MP Wiki
Tip | 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).
(playerid)
playerid | The 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.
- IsPlayerAdmin: Checks if a player is logged into RCON.
Related Callbacks
The following callbacks might be useful, as they're related to this function in one way or another.
- OnPlayerConnect: Called when a player connects to the server.
- OnPlayerDisconnect: Called when a player leaves the server.