This is a serverside AS1 function keeps messing up and looping past the number of players after the last player is dead… Any ideas how to best do this?
var playerTurn=0;
var stopLoop=0;
function nextTurn() {
turnTick=0;
stopLoopAt = room.getMaxUsers();
while (Players[playerTurn].Alive == false && stopLoop < stopLoopAt) {
++playerTurn;
++stopLoop;
}
takeTurn(Players[playerTurn].sfsId);
currentTurn=playerTurn;
++playerTurn;
if (playerTurn == stopLoopAt){
playerTurn = 0;
}
}