Sign in to follow this  
0xNull

Что-то жрёт переменную

Recommended Posts

Есть такой код:

 


var countplayers=0;
var launch=0;

mp.events.add('playerJoin', (player) => {
  player.robber = 0;
  player.ingame = 0;
  player.hello = 0;
});

mp.events.addCommand('chase', (player) => {
  if (countplayers == 0){
  if (player.ingame== 0 && launch == 0){
    player.robber = 1;
    player.ingame = 1;
    countplayers +=1;
    setTimeout(startmp, 10000);
  }}
  else {
  if (launch == 0 && player.ingame == 0){
     player.hello = 1;
     player.ingame =1;
     console.log(player.hello);
  }
}
  function startmp(){
    console.log(player.hello);
    launch = 1;
  }
});

 

До того, как скрипт дойдёт до функции startmp - переменная player.hello равна 1.

После - равна 0. Хотя player.robber остаётся равна 1. 

 

Что это такое? Как это фиксить то?
 

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.