Getting Started with Commands

From RAGE Multiplayer Wiki
Jump to navigation Jump to search


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."weapon", (player, fullText, weapon, ammo) => {
	let 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.


We have showed you an example up there about how the command system works. Now we'll tell you what is the use of the parameters that was shown."<name>", (player, args, arg1, arg2)
  • <name>: This is the place where you can put your command name. For example i'll name it hello.

So now it will look like that:"hello", (player, fullText, arg1, arg2)
  • player: Player is a main definition you have to keep it the same and never change it. Player is used to get information about the player who executed the command.
  • fullText: This will get all the words that the player typed after the command. For example if I typed /Hello I am so cool it will return you with I am so cool. You can name it whatever you want, so i'll keep it FullText.
  • arg1, arg2: Those are optional parameters where you can get certain words. For example I made /Hello I am so cool, so if you tried to console.log(args1) it will return I. You can add any defined words you want.

So as a result the command will look like this:"hello", (player, fullText, arg1, arg2) => {
	player.outputChatBox(`Hello! ${}`);

So today we learned how the commands work and how you can use the parameters. For more detailed info about commands you can Click Here.

I wish you learned today how you can use the commands, and I wish you a happy scripting!