22.07.2018, 07:21
[HELP] How to check server empty?
22.07.2018, 07:41
If you are using y_iterate you can use Iter_Count(Player) to get number of online players and check if it is zero
22.07.2018, 15:19
(
Последний раз редактировалось grymtn; 22.07.2018 в 19:46.
)
or if you dontwant to use iterators you can just create a global variable like below.
Then under OnPlayerConnect:
Then ofcourse OnPlayerDisconnect:
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:
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.
Код:
new myonlineplayers=0;
Код:
myonlineplayers++;
Код:
myonlineplayers--;
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++; } }
Edit: fixed wrong spelled word.
22.07.2018, 18:22
Quote:
Код:
new mycount=0; for(new i=0; i<MAX_PLAYERS; i++) { if(myonlineplayers[i]==1) { mycount++; } } |
22.07.2018, 19:44
i told him to change it to an array there. i didnt specify with my coding. i turned it in to a loop because check what he asked. HE WANTED A LOOP. So i gave him a loop if he changes it in to an array. the first one i do keeps the online count. the loop with array keeps which ids are online, which is what he asks and what he gave example of in pastebin. Is it really that hard to see it there?
« Next Oldest | Next Newest »
Users browsing this thread: 2 Guest(s)