SA-MP Forums Archive
Checking how many players are alive and connected - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checking how many players are alive and connected (/showthread.php?tid=132071)



Checking how many players are alive and connected - Hot - 06.03.2010

I have made this function but it does not work. It does not get how many players are alive and connected. It always return 0. I have set sAlive to true at OnPlayerSpawn and have set it to false at OnPlayerDisconnect and OnPlayerDeath. Any reason why it should not work?

Код:
stock GetPlayers() {
	new players;
	for(new i=0; i<MAX_PLAYERS; i++) {
	  if(IsPlayerConnected(i) && sAlive[i] == true && !IsPlayerNPC(i)) {
	    players++;
	  }
	}
	return players;
}



Re: Checking how many players are alive and connected - Hot - 06.03.2010

Sorry for bumping, but i really need this before 12:00 pm, and here in my country is already 11:13 pm