[HELP] How to check server empty?
#3

or if you dontwant to use iterators you can just create a global variable like below.

Код:
new myonlineplayers=0;
Then under OnPlayerConnect:

Код:
myonlineplayers++;
Then ofcourse OnPlayerDisconnect:

Код:
myonlineplayers--;
After that you just need a command that will tell you the number that your variable holds.

If you really want to use a loop you can create an array* variable for max players and when they disconnect you can turn it to 0 and ofcourse on login you can do switching it to 1. so your loop would be like:

Код:
new mycount=0;
for(new i=0; i<MAX_PLAYERS; i++)
{
    if(myonlineplayers[i]==1)
    {
        mycount++;
    }  
}
Then you can print that mycount variable to your screen if you want or do whatever you need with it. But it would be the same thing as using iterators because thats basically an iterator.

Edit: fixed wrong spelled word.
Reply


Messages In This Thread
[HELP] How to check server empty? - by Charisma - 22.07.2018, 07:21
Re: [HELP] How to check server empty? - by SyS - 22.07.2018, 07:41
Re: [HELP] How to check server empty? - by grymtn - 22.07.2018, 15:19
Re: [HELP] How to check server empty? - by Banditul18 - 22.07.2018, 18:22
Re: [HELP] How to check server empty? - by grymtn - 22.07.2018, 19:44

Forum Jump:


Users browsing this thread: 1 Guest(s)