Player::kick: Difference between revisions

From RAGE Multiplayer Wiki
m (Replaced HTML with template)
m (category)
Line 25: Line 25:
==See Also==
==See Also==
{{Player_block}}
{{Player_block}}
[[Category:Player]]
[[Category:Server-side Function]]

Revision as of 12:48, 30 April 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