01.05.2018, 00:27
Hello, so I'm having some trouble trying to fix this, and finally I have ran out of ideas.
So I got this loop:
I have checks, so if people disconnect and players reach 0, it won't start, the problem comes when someone disconnects while the loop is running, and Player counter reaches 0, then the loop will go forever and freeze the server. I have tried this:
I have tried checking player counter while in the loop, but nothing.
Any ideas? Thank you.
So I got this loop:
PHP код:
new random = INVALID_PLAYER_ID;
do{
random = Iter_Random(Player);// I use foreach include (pick a random player).
}while(!IsLoggedIn[random] || IsJailed[random] == 1 || IsAFK[random] == 1);
PHP код:
new random = INVALID_PLAYER_ID, counter = 0;
do{
random = Iter_Random(Player);
counter++;
}while(!IsLoggedIn[random] || IsJailed[random] == 1 || IsAFK[random] == 1 || counter < 30);//to try and stop it, but still freezes the server.
Any ideas? Thank you.