Help with one thing :D
#5

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
You can simple count how many players are spawned with a loop, then divide it by the players that are online:

pawn Код:
// Get the amount of online players first
new onlineplayers = 0;
for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerConnected(i)) onlineplayers ++;
}

new counter = 0;
for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerSpawned(i)) counter ++;     // Replace IsPlayerSpawned with the method you use to check it
}
if((float(counter) / float(onlineplayers)) > 0.5)
{
    // More than 50% spawned, do something cool here ;)
}
I never knew how to use the counts and i learnt everything from this little post,thanks
Reply


Messages In This Thread
Help with one thing :D - by WillyP - 06.12.2010, 18:21
Re: Help with one thing :D - by Mauzen - 06.12.2010, 18:35
Re: Help with one thing :D - by Scenario - 06.12.2010, 18:36
Re: Help with one thing :D - by WillyP - 06.12.2010, 18:38
Re: Help with one thing :D - by SkizzoTrick - 06.12.2010, 18:38
Re: Help with one thing :D - by WillyP - 06.12.2010, 18:44
Re: Help with one thing :D - by SkizzoTrick - 06.12.2010, 18:46
Re: Help with one thing :D - by WillyP - 06.12.2010, 18:47
Re: Help with one thing :D - by Mauzen - 06.12.2010, 18:47
Re: Help with one thing :D - by WillyP - 06.12.2010, 18:49

Forum Jump:


Users browsing this thread: 4 Guest(s)