[Help] "news Alives;"
#8

Quote:
Originally Posted by Unte99
Посмотреть сообщение
Код:
new Alives;

public OnPlayerConnect(playerid)
{
	Alives++;
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	Alives--;
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	Alives--;
	return 1;
}
And yes, that code will get the number of online players.
You are not helping him get "alives" count, but Online counts, he simply wants to check how many players on server are alive, he is doing it wrong, and you are doing it worse


Buddy, you should make something like
PHP код:
new Alive[MAX_PLAYERS]; 
put these under mentioned callbacks:

PHP код:
OnPlayerConnect Alive[playerid]=0;
OnPlayerDisconnect Alive[playerid]=0;
OnPlayerDeath Alive[playerid]=0;
OnPlayerSpawn Alive[playerid]=1
and under your GetPlayersOnServer
PHP код:
GetPlayersOnServer()
{
    new 
count;
    
Alives=0;
    for(new 
x=0xMAX_PLAYERSx++)
    {
         if(
IsPlayerConnected(x)))
         {
            
count++;
            if(
Alive[playerid]==1Alives++;
            
        }
    }
    return 
count;

And now it does what you want it to do, count alives in the server while counting onlines too
Reply


Messages In This Thread
[Help] "news Alives;" - by Luicy. - 12.10.2015, 17:55
Re: [Help] "news Alives;" - by bgedition - 12.10.2015, 18:08
Re: [Help] "news Alives;" - by Luicy. - 12.10.2015, 18:21
Re: [Help] "news Alives;" - by Isolated - 12.10.2015, 18:26
Re: [Help] "news Alives;" - by bgedition - 12.10.2015, 18:29
Re: [Help] "news Alives;" - by Luicy. - 13.10.2015, 13:09
Re: [Help] "news Alives;" - by Unte99 - 13.10.2015, 14:08
Re: [Help] "news Alives;" - by PrO.GameR - 13.10.2015, 16:53
Re: [Help] "news Alives;" - by Unte99 - 13.10.2015, 17:46
Re: [Help] "news Alives;" - by Luicy. - 13.10.2015, 17:50

Forum Jump:


Users browsing this thread: 1 Guest(s)