Detect players in team?
#1

Heey all,
How can i detect the players in a team like:
/detectcops

Cops:
Admigo

Thanks Admigo
Reply
#2

I suggest adding more detail to your request.

For example, are you talking about something like this?

pawn Код:
CMD:detectcops(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "(Online) Cops:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pFaction] == 1)
                    {
                        new factiontext[64], sendername[MAX_PLAYER_NAME], string[128];
                        if(PlayerInfo[i][pRank] == 6) { factiontext = "Rank 6"; }
                        else if(PlayerInfo[i][pRank] == 5) { factiontext = "Rank 5"; }
                        else if(PlayerInfo[i][pRank] == 4) { factiontext = "Rank 4"; }
                        else if(PlayerInfo[i][pRank] == 3) { factiontext = "Rank 3"; }
                        else if(PlayerInfo[i][pRank] == 2) { factiontext = "Rank 2"; }
                        else if(PlayerInfo[i][pRank] == 1) { factiontext = "Rank 1"; }
                        else { factiontext = "Rank default"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        sendername[strfind(sendername,"_")] = ' ';
                        if(FactionDuty[i] == 0)
                        {
                            format(string, 128, "%s: %s [Duty: No]", factiontext, sendername);
                            SendClientMessage(playerid, random(0xFFFFFFFF), string);
                        }
                        else
                        {
                            format(string, 128, "%s: %s [Rank: %d] [Duty: Yes]", factiontext, sendername);
                            SendClientMessage(playerid, 0xFAAFBEFF, string);

                        }
                    }
                }
            }
        }
        return 1;
}
Note: Above was just an example, it uses ZCMD aswell as sscanf and other includes/plugins you might not have.

If you have an enum like above, and have Rank and Faction in it, you can see their name and rank they are.

Sorry if I didn't answer your question, didn't really specify much in it.

*Note2: Command is untested, made this from my /admins command that displayed the online admins*
Reply
#3

Like KurtBag stated, all you need to do, is a loop through all online players and check the team variable. In order to help you more, we'll need your team variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)