Sign in to follow this  
Freamee

setVariable is not overwriting it

Recommended Posts

Hi.

I created a trunk with variables.

But when im trying to add items in it.

Its not overwriting the value, its adds next to the value.

like /put 45 --> 45, then /put 35, and the variable is 4535.

 

Any idea?

Share this post


Link to post
Share on other sites

i can not make it work. Can you help ?

t75fSdm.png

 

 

 if(param2 == "mati" || param2 == "material")
    {
      if(!player.hasItemInInventory('Alkatrész')) return player.pushError("Nincs nálad egy darab alkatrész sem!");
 
      parseInt(darab);
      if(darab == undefinedreturn player.pushExample("/(k)o(cs)i bepakol mati [darabszám]");
      if(darab <= 0 || darab > 100000return player.pushError("1 és 100.000 között adj meg darabszámot!");
 
      if(darab > p_mennyimatireturn player.pushError(`Nincs ennyi alkatrészed. Nálad található: ${p_mennyimati}`);
      //if(osszeadas > KOCSI_MAX_MATERIAL) return player.pushError(`Nem fér ennyi a kocsiba. Maradék hely: ${KOCSI_MAX_MATERIAL-mennyim}`)
      player.pushSiker(`Beraktál a kocsiba ${darab}db. alkatrészt.`);
 
      ez = mennyim + darab;
 
      if(id.getVariable('Material'== 0id.setVariable("Material"darab);
      else {
        id.setVariable('Material'ez);
      }
    }  

Share this post


Link to post
Share on other sites

Best way to handle with your errors is to log everything that dont work just like you want. 

try log 

console.log( mennyim + darab );

to see the results. 

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.