fh237 Posted May 22, 2020 Posted May 22, 2020 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}`) });
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now