Player::kick: Difference between revisions

From RAGE Multiplayer Wiki
m (category)
m (category)
Line 1: Line 1:
__NOTOC__
Kicks a player from the server.
Kicks a player from the server.


Line 26: Line 25:
{{Player_block}}
{{Player_block}}


[[Category:Player]]
[[Category:Player API]]
[[Category:Server-side Function]]
[[Category:Server-side Function]]

Revision as of 17:00, 17 May 2019

Kicks a player from the server.

Syntax

player.kick(reason);

Parameters

  • reason: String (This message does not show up for the player being kicked)

Examples

Server-Side
mp.events.addCommand('kick', (player, target) => {
	let newTarget = mp.players.at(target);
	if(!target || isNaN(target)) return player.outputChatBox("Syntax: /kick [playerID]");
	if(newTarget === null) return player.outputChatBox("There is no player online with the ID given.")
	newTarget.outputChatBox("You have been kicked from the server.");
	newTarget.kick('Kicked.');
});

See Also