Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Option 1: use a custom foreach iterator to store alive players and then use Iter_Count. Option 2: do a manual loop over all the players and increment a counter if the state of the player is not "wasted" or "spectating".
Posts: 293
Threads: 20
Joined: Jan 2017
19.05.2017, 18:49
(
Последний раз редактировалось YouHack; 20.05.2017 в 10:33.
)
PHP код:
new Alive = 0;
public OnPlayerConnect(playerid)
{
Alive++; // if you want to set player as alive when he joins
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_WASTED || PLAYER_STATE_SPECTATING) { Alive++; }
else if(newstate == !(PLAYER_STATE_WASTED || PLAYER_STATE_SPECTATING)) { Alive--; }
return 1;
}
// use Alive variable in textdraw ^^
Posts: 175
Threads: 1
Joined: Apr 2017
Reputation:
0
Have a global variable, and when the player joins the event or spawns increase the variable by 1. When a player leaves the event or gets slapped, decrease the variable. Simple as that.