How to count how much players in a faction
#3

Just access the data itself where ever it's stored and then print it or something.

How to count the players, use something like:
pawn Код:
#define MAX_FACTIONS 10 //See GetMemberCountInFaction for information regarding this.

new Ply_FactionID[MAX_PLAYERS]; //Something like this where their Current Faction ID is stored.



stock GetMemberCountInFaction(factionid){

    if(factionid > (MAX_FACTIONS - 1) || factionid < 0)
        return -1; /*We don't want to even run the loop to get an out of bounds error if the factionid is invalid.
        Return -1 so that you'll know the faction ID is invalid and not that the faction is invalid and there just aren't
        any players in it.
        */

       

    new mcount;
    for(new i = 0, x = GetPlayerPoolSize(); i <= x; i++){ //Loop through all of the players.

        if(!IsPlayerConnected(i)) continue; //If they're not connected, skip them.

        if(Ply_FactionID[i] == factionid) mcount ++; //If their faction matches the requested, add them to the count.
    }

    return mcount;
}
Reply


Messages In This Thread
How to count how much players in a faction - by DemME - 22.05.2016, 23:41
Re: How to count how much players in a faction - by Stinged - 23.05.2016, 03:55
Re: How to count how much players in a faction - by Banana_Ghost - 23.05.2016, 03:58
Re: How to count how much players in a faction - by Abagail - 23.05.2016, 04:17
Re: How to count how much players in a faction - by Nin9r - 23.05.2016, 08:17
Re: How to count how much players in a faction - by DemME - 23.05.2016, 12:22

Forum Jump:


Users browsing this thread: 2 Guest(s)