What is Rage Multiplayer?

Rage Multiplayer is a multiplayer client for Grand Theft Auto V. Rage multiplayer uses various native functions to create a seamless multiplayer experience for Grand Theft Auto V. Although it is not endorsed by Rockstar games in any way, you still must buy the game in order to play Rage Multiplayer.

Getting Started

To setup a project visit the Rage Wiki and setup for C#. These tutorials will be primarily focusing on the C# aspect of the server. You can visit the wiki here.

Programming

In this post we'll be learning how to use the command attribute in the C# API for RAGE.MP.

The attribute kind of looks like this: [Command("mycommandname")]

As long as this attribute is above any public void function you'll be able to use the command.

Let's take a look at the basic structure of a new class file:

public class MyCustomResource : Script
{
    [Command("sethealth")]
    public void CmdSetHealth(Client client, int amount) 
    {
        // My command logic.
    }
}

As you can see we have a class and it inherits the script class to allow commands to be ran at run-time. We've also added a command that takes in the person who 'initiated' the command. client is the person who calls the command in-game and there is also an additional parameter for an amount which will be used to set the player's health.

in-game the command is basically ran like:
/sethealth 5

So let's write the basic logic for this command.

All we need to do is add a single line:

client.Health = amount;

It's a very simple piece of logic.

public class MyCustomResource : Script
{
    [Command("sethealth")]
    public void CmdSetHealth(Client client, int amount) 
    {
        client.Health = amount;
    }
}

And thus we have our very first working command!