KickPlayer: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Complete Lua function catalog
Document 0.1a Lua API, identities, moderation and synchronized spells
 
Line 1: Line 1:
<!-- This page is generated automatically from the function definition: kickPlayer. -->
= kickPlayer =
= kickPlayer =
Disconnects a player from the server with an optional reason.
Disconnects a player from the server with an optional reason.
Line 29: Line 28:
* Available only in server-side resource scripts.
* Available only in server-side resource scripts.
* Use resource permissions to restrict administrative commands that call this function.
* Use resource permissions to restrict administrative commands that call this function.
* An accepted kick immediately revokes the player's voice session, ends the gameplay connection and closes the game client. The launcher then displays the kick reason.
* A kick is not persistent. The player may start the game and join again unless a resource or administrator uses <code>banPlayer</code> instead.


[[Category:Lua Functions]]
[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Player Functions]]
[[Category:Player Functions]]

Latest revision as of 11:36, 27 August 2026

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.
  • An accepted kick immediately revokes the player's voice session, ends the gameplay connection and closes the game client. The launcher then displays the kick reason.
  • A kick is not persistent. The player may start the game and join again unless a resource or administrator uses banPlayer instead.