Members online
#3

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Suppose you have 3 gangs G1 G2 G3,
you can put it this way
PHP код:
new Count1//This will store the number of connected players in gang number 1
    
Count2//This will store the number of connected players in gang number 2
    
Count3//This will store the number of connected players in gang number 3
//Now loop through all players
for(new i=0;i<GetPlayerPoolSize();i++){
    if(!
IsPlayerConnected(i)) continue; //If the player is not connected, the following lines won't be executed for that specific player id, so the seleced id will increment
    
if(PlayerGang[i] == G1Gcount1++; //if a player is in gang 1 the GCount1 variable will increment
    
if(PlayerGang[i] == G2GCount2++; //if a player is in gang 2 the GCount2 variable will increment
    
if(PlayerGang[i] == G3GCount3++; //if a player is in gang 3 the GCount3 variable will increment
}
//Now display the results
printf("Connected Members from gang 1: %d",GCount1);
printf("Connected Members from gang 2: %d",GCount2);
printf("Connected Members from gang 3: %d",GCount3);
//Replace the PlayerGang[MAX_PLAYERS] array with your own 
A little criticism of mine, if you give examples, you might want to consider doing it properly :P
Reply


Messages In This Thread
Members online - by AdzeeH - 02.02.2017, 15:26
Re: Members online - by Eoussama - 02.02.2017, 15:35
Re: Members online - by BiosMarcel - 02.02.2017, 15:36
Re: Members online - by Eoussama - 02.02.2017, 15:41
Re: Members online - by AndreiWow - 02.02.2017, 15:48
Re: Members online - by BiosMarcel - 02.02.2017, 16:01
Re: Members online - by AdzeeH - 02.02.2017, 20:07
Re: Members online - by GangstaSunny. - 02.02.2017, 21:29

Forum Jump:


Users browsing this thread: 3 Guest(s)