02.02.2017, 15:35
Suppose you have 3 gangs G1 G2 G3,
you can put it this way
you can put it this way
PHP код:
CMD:membersonline(playerid){
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] == G1) Gcount1++; //if a player is in gang 1 the GCount1 variable will increment
if(PlayerGang[i] == G2) GCount2++; //if a player is in gang 2 the GCount2 variable will increment
if(PlayerGang[i] == G3) GCount3++; //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);
return 1;
}
//Replace the PlayerGang[MAX_PLAYERS] array with your own
//This is an example for ZCMD/iZCMD/YCMD... Command processores