SA-MP Forums Archive
Number of faction members online - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Number of faction members online (/showthread.php?tid=143032)



Number of faction members online - IVuljak - 20.04.2010

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?


Re: Number of faction members online - IVuljak - 21.04.2010

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


Re: Number of faction members online - Injection - 21.04.2010

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...