IsPlayerConnected
isPlayerConnected
Checks whether a player identifier belongs to a connected client.
Syntax
bool isPlayerConnected(int playerId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The player identifier to check. |
Returns
Returns true when the player is connected; otherwise returns false.
Examples
Validate a player before changing state:
if isPlayerConnected(playerId) then
outputChatBox("You are connected", playerId)
end
Notes
- Available only in server-side resource scripts.