Little 'bit of an issue.

Discussion in 'CommandHelper' started by MPKingJulian, Aug 9, 2017.

  1. MPKingJulian

    MPKingJulian New Member

    So I ran into a little issue (like always),

    This isn't a bug although it's something that I am confused on how to do. Basically, I have an alias to go to a specific game. When you go to that specific game it teleports you to the world. If there are more than 2 people in the specific world it runs a series of events (or methods). I basically do it how @PseudoKnight showed me.
    [commandhelper]if(array_size(all_players('world')) > 1) {[/commandhelper]

    Now when you run the command it starts a countdown. It works perfectly. I also implemented this so the countdown doesn't start again with 3 people:

    [commandhelper]if(array_size(all_players('world')) > 2) {[/commandhepler]

    Everything works fine although when people run the command around the same exact time it runs whatever I put in the "if(array_size(all_players('world')) > 1) {" (Starts a countdown twice). So it will mess up the entire game start.

    This isn't a bug although I really don't know a way to get around it and I'm not sure if anyone else has a solution.

  2. PseudoKnight

    PseudoKnight Well-Known Member Developer

    This can happen if there's a delay on the teleportation. If there isn't, then all_players(world) list might not be updating on the same tick that you teleport them. If that's the case, it might not make for a good condition and instead you'll have to create some sort of flag when you start the countdown. There's lots of ways of doing that.
    MPKingJulian likes this.