0xNull

Own variable for each player

Recommended Posts

Hello! How create variable for each player? For example, if player type command "tomp" - his varialable chande to 1? Not all players, only for his?

My code:

mp.events.addCommand('tomp', (player) =>{
if (startmp == 1){
  uch = true;
}
});

But it code - varialabe "uch" change if any player type "tomp", but need for himself. Please, help me)

Share this post


Link to post
Share on other sites
6 часов назад, iRandomXx сказал:

Hi my friend ! I don't understand. You want a UCH boolean for each player ?

It seems that I have already solved this problem, but this is not very accurate. Here's how:

 

mp.events.addCommand('tomp', (player)=>{

if (startmp == 1){
player.uch = 1;

}
});

Share this post


Link to post
Share on other sites
14 hours ago, 0xNull said:

It seems that I have already solved this problem, but this is not very accurate. Here's how:

 

mp.events.addCommand('tomp', (player)=>{

if (startmp == 1){
player.uch = 1;

}
});

This is accurate if do well what you want to do.

mp.events.addCommand("tomp", (player) => {
 if(startmp == 1) player.uhc = 1; // What is startmp variable ?
}

Just remove brackets when you just use one function in a IF / ELSE, it's more beautiful looked ! No ? xD

 

Share this post


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.