Jump to content
RAGE Multiplayer Community

Command with multiple parameters


Recommended Posts

Hello, I'm trying to create a command that gives me a weapon I typed with the number of bullets I typed.

For example: /weapon weapon_pistol 1000

This command gives me a pistol with a 1000 guns.

I've tried addCommand ('weapon', (player, weapon, bullets), but it doesn't work.

I know how to do this in lua, but not on JS.

Thanks in advance.

Link to post
Share on other sites
mp.events.addCommand("mute", (player, _, target, ...reason) => {
    if(player.admin >= 3) 
    {
        let newTarget = functions.functions.findPlayerByIdOrNickname(target);
        console.log(newTarget);
        let newReason = reason.join(' ');
        if(target == null) return player.outputChatBox(`!{32a852}[USAGE]: !{ffffff} /mute [Player] [Reason]`);
        if(newTarget.muted === false) 
        {
            if(reason == null) return player.outputChatBox(`!{32a852}[USAGE]: !{ffffff} /mute [Player] [Reason]`);
            newTarget.muted = true;
            player.outputChatBox(`!{b82e2e}[ADMIN]:  ${newTarget.name} muted!`);
            newTarget.outputChatBox(`!{b82e2e}[ADMIN]: Muted by ${player.name} Reason: ${newReason}`);
        }
        else 
        {
            newTarget.muted = false;
            newTarget.outputChatBox(`!{b82e2e}[ADMIN]: unmuted.`);
        }
    }
    else
    {
        player.outputChatBox(`!{b82e2e}You are not admin!`);
    }
});

For example:

  • Like 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...