KickPlayer
kickPlayer
Disconnects a player from the server with an optional reason.
Syntax
bool kickPlayer(int playerId [, string reason = "Kicked by the server"])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
reason |
string |
no | Optional user-facing disconnect reason. |
Returns
Returns true when the kick request is accepted; otherwise returns false.
Examples
Kick a player after a server-side validation failure:
kickPlayer(playerId, "Invalid character state")
Notes
- Available only in server-side resource scripts.
- Use resource permissions to restrict administrative commands that call this function.