Posts: 775
Threads: 78
Joined: Dec 2014
So.. In my derby GM I got this..
and
Код:
GetPlayersOnServer()
{
new count;
for(new x=0; x< MAX_PLAYERS; x++)
{
if(IsPlayerConnected(x)))
{
count++;
Alives++;
}
}
return count;
}
So..
Will
Set the "new" to the current online?
Posts: 775
Threads: 78
Joined: Dec 2014
Like, Will the "new Alives;"
update to "GetPlayersOnServer()"
Posts: 801
Threads: 30
Joined: Mar 2013
Reputation:
0
Why are you counting the same thing twice? Remove the Alives, and just the function as is. It will return the amount of players connected, not weather they are spawned or not.
Posts: 417
Threads: 40
Joined: Oct 2013
Reputation:
0
Maybe Alives++ is used for something else in the script.
Posts: 775
Threads: 78
Joined: Dec 2014
Quote:
Originally Posted by Isolated
Why are you counting the same thing twice? Remove the Alives, and just the function as is. It will return the amount of players connected, not weather they are spawned or not.
|
No, The count and alives are for different things, As you can see "return count;"
if I would replace that with alive, it would be fucked up,
As people dies in the derby,
Posts: 775
Threads: 78
Joined: Dec 2014
Quote:
Originally Posted by PrO.GameR
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=0; x< MAX_PLAYERS; x++)
{
if(IsPlayerConnected(x)))
{
count++;
if(Alive[playerid]==1) Alives++;
}
}
return count;
}
And now it does what you want it to do, count alives in the server while counting onlines too
|
I know what I want to do, He helped me out there, Cause It's derby I got another for "Alive", So Alive will be like this:
Remove on death, Disconnect, player exits vehicle.
and add:
On spawn, after it's only one left
----To Helper:
Thank you.