I'm attempting to make a player counter for an events I'm making. It works fine up till the end, in which I want to display the winning players name. Instead of doing that it seems to be just picking a person at random from the server and saying they win. Anyways, I'm pretty much completely new to scripting, started like 5 days ago, and I can't figure out what the problem could be. Any and all help would be appreciated.
PHP Code:
function onPlayerDies(pl){
temp.cot = -1;
for (temp.pl : players) {
if (temp.pl.level.name == player.level.name){
if (pl.guild == "Events Team") {
continue;
}
cot ++;
}
}
if (cot == 1){
this.start = 0;
setTimer(1);
}
else {
message(cot SPC "players left!");
}
}
function onTimeout(){
for (temp.pl: allplayers) {
if (temp.pl.level.name == player.level.name){
if (pl.guild == "Events Team") {
continue;
}
message(temp.pl.communityname SPC "wins!");
}
}
}