IsPlayerConnected
Description:
Function IsPlayerConnected checks if a player is connected (if an ID is taken by a connected player).
This function can be omitted in a lot of cases. Many other functions already have some sort of connection check built in. |
Parameters:
(playerid)
int | playerid | The ID of the player to check. |
Return Values:
- 0: Player is NOT connected.
- 1: Player IS connected.
Examples:
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 well, as they are related to this callback in one way or another.
- OnPlayerConnect: Called when a player connects to the server.
- OnPlayerDisconnect: Called when a player leaves the server.