how to count players -
bleedis - 07.01.2013
Hello friends!
I saw a filterscript in forum called last man standing or something like that, but link was dead, so i decided to create someting like that for my server. So i will get to the point. How can i count players who are in that event like if player joins event
pawn Код:
PlayerInfo[playerid][InLM] = 1;
It counts +1
When someone leaves
pawn Код:
PlayerInfo[playerid][InLM] = 0;
it counts -1 and updates in textdraw, i tried in way that doesnt worked for me like when someone joins its counts + and its shows for him in textdraw that its 1/20 but when leaves there still stays 1/20 i hope someone understands me
Thank ya all for answers.
Re: how to count players -
DiGiTaL_AnGeL - 07.01.2013
All you need is a variable. First, create the variable :
Then, in the cmd for joining the event, simply change it's value :
And then you can check if the player is at the event by checking the variable like that :
I think you know what to do from here. If you don't, just post what you don't know.
Re: how to count players -
park4bmx - 07.01.2013
make a
global variable like
new Team1=0;
then every time they join the team do
Team1++; and when leave
Team1--;
simple
Re: how to count players -
JaKe Elite - 07.01.2013
you just setting the variable to 1 and 0 that's why it won't work.
it must be += 1; if someone leaves, -= 1;
Re: how to count players -
park4bmx - 07.01.2013
Quote:
Originally Posted by Romel
you just setting the variable to 1 and 0 that's why it won't work.
it must be += 1; if someone leaves, -= 1;
|
that is his
enum variables.
its for to check if the player is in
InLM as you can see
PlayerInfo[playerid][InLM]
not a counter !
Re: how to count players -
Sinner - 07.01.2013
Use a loop and count all the players where PlayerInfo[i][InLM] > 0
pawn Код:
new total = 0;
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(PlayerInfo[i][InLM])
total++;
}
}
// total will now contain the total amount of players in Last Man Standing
printf("The total amount of players still in LM is: %d", total);
Re: how to count players -
bleedis - 07.01.2013
Thank ya all!
In a fact i didnt mention it but i have that global variable thingy.
Sinner i will try your way now.