Jump to content
RAGE Multiplayer Community

Help how to create a easy command


Recommended Posts

Hello, I know very little about programming and I am trying to learn, how could I make the second command work and show the player color?

First command work nice but second command says "Your color is undefined"

mp.events.addCommand("color", (player, _, playerColor) =>{
    if (playerColor == 'red') {
        let playerColor = 'red';
        player.outputChatBox(`You selected ${playerColor} color`);
    }
    if (playerColor == 'blue') {
        let playerColor = 'blue';
        player.outputChatBox(`You selected ${playerColor} color`);
    }
    if (playerColor == 'yellow') {
        let playerColor = 'yellow';
        player.outputChatBox(`You selected ${playerColor} color`);
    }
});

mp.events.addCommand("mycolor", (player, playerColor) => {
    player.outputChatBox(`Your color is ${playerColor}`)


});

 

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...