Player::ban

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function bans the player from your server.

Note: The ban reason doesn't display for the player, you need to use something else to display it for the player. Also, all bans that use this function are cleared once the server restarts. You need to save the bans yourself if you want them to stay after restarting your server.

Syntax

player.ban(reason)

Parameters

  • reason: String

Example

Creates a ban command.

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


See Also