From RAGE Multiplayer Wiki



This function registers a command handler.

JavaScript Syntax

Syntax, handlerFunction);

Required Arguments

  • commandName: String (The name of the command you wish to attach a handler to)
  • handlerFunction: Void (The function that you want the command to trigger, which has to be defined before you add the handler)

Handler function parameter

player, fullText [, arg1, arg2, ...] 
  • player: Object
  • fullText: Array (All arguments after the command name)
  • arg1, arg2, ...: Any (Each argument after the command name)


This example gives a weapon to the current player with the specified number of ammo. If not specified, it will give 10000.

Server-Side"weapon", (player, fullText, weapon, ammo) => {
	var weaponHash = mp.joaat(weapon);

	player.giveWeapon(weaponHash, parseInt(ammo) || 10000);


This example implements /me command

Server-Side"me", (player, message) => {
	mp.players.broadcast(`* ${}: ${message}`);

See Also