Number of faction members online
#1

Hi, i need a help with command which shows how many members of faction are online (only numeric, not names)
I want to be something like this: *** There are 3/15 police officers online *** (if there are only 3 at that time)
here is the example to see their names:
pawn Код:
if(strcmp(cmd,"/members",true)==0)
    {
      if(IsPlayerConnected(playerid))
      {
            new teamnumber;
            if (PlayerInfo[playerid][pLeader] != 0) teamnumber = PlayerInfo[playerid][pLeader];
            else if (PlayerInfo[playerid][pMember] != 0) teamnumber = PlayerInfo[playerid][pMember];
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You're not faction member!");
                return 1;
            }
             SendClientMessage(playerid, 0x808000AA, "**Members Online**");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if (IsPlayerConnected(i))
                {
                    GetPlayerName(i, sendername, sizeof(sendername));
                    format(string, sizeof(string), "");
                    if (PlayerInfo[i][pLeader] == teamnumber) format(string, sizeof(string), "%s (Leader)",sendername);
                    else if (PlayerInfo[i][pMember] == teamnumber) format(string, sizeof(string), "%s, Rank: %d.",sendername, PlayerInfo[i][pRank]);
                    if (strlen(string) > 1) SendClientMessage(playerid, 0xF5DEB3AA, string);
                }
            }
        }
        return 1;
    }
can someone help?
Reply
#2

please someone?
I know script has to read from .ini files but can someone post me an example
Reply
#3

Open a .ini file and write (with dini, or another .ini tool) there something like this: "Police_Members=0",
And when you invite/uninvite players to your faction, you simply update the file.
And in your command you simply read it from file...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)