Getting Started with Commands

From RAGE Multiplayer Wiki
Revision as of 08:59, 3 October 2017 by Unknown (talk | contribs) (→‎Intro)

Intro

Commands are simple and easy to use via your server chat to do many things. Today we will show you how simple is it to create easy commands that can be useful for your server. Let's see the example below.

mp.events.addCommand("weapon", (player, fullText, weapon, ammo) => {
	var weaponHash = mp.joaat(weapon);

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

});

This example shows a command with name weapon which gives the player weapon with ammo. If the player doesn't specify the ammo, the system will give him 10000 ammo automatically.

How does it work? Simply you go to the chat and type /weapon <weapon_name> <ammo> For example, /weapon weapon_pistol 100. This example gives me a pistol with 100 ammo. to see the list of weapons Click Here.