SA-MP Forums Archive
/members Command - 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)
+--- Thread: /members Command (/showthread.php?tid=496252)



/members Command - NewbieTester - 21.02.2014

Hey Guys , I Have a Roleplay Server , GM Edit , And I Need the /members Command That will show the Online Family/Faction Members , Can Someone Help Me ?

Here's The Member Code :
Код:
PlayerInfo[playerid][pMember] and PlayerInfo[playerid][pLeader]



Re: /members Command - FilesMAker - 21.02.2014

You need to make a boucle.
Код:
SendClientMessage(playerid, Colour, "--------| Member and Stuff |--------");
for(new i; i<MAX_PLAYERS; i++)
{ 
      if(!IsPlayerConnected(i)) return 0;
      if(PlayerInfo[i][pMember] > 0) SendClientMessage(playerid, Colour, Message);
}
SendClientMessage(playerid, Colour, "------------------------------------");
You can add your style


Re: /members Command - Aerotactics - 21.02.2014

Removed

Im too tired to provide logical help :/


Re: /members Command - Vanter - 21.02.2014

PHP код:
dcmd_members(playeridparams[])
{
        new 
amount[2], string[200], shortstr[55], pname[24];
        
SendClientMessage(playerid0xFFFFFFFF"Group members online:");
        for(new 
i=0i<MAX_PLAYERSi++)
        {
                if(
IsPlayerConnected(i))
                {    
                        
amount[0] ++;
                        
amount[1] ++;
                        
GetPlayerName(ipname24);
                        if(
PlayerInfo[playerid][pLeader] != iformat(shortstrsizeof(shortstr), "%s(%d),"pnamex);
                        if(
PlayerInfo[playerid][pLeader] == iformat(shortstrsizeof(shortstr), "[LEADER] %s(%d),"pnamex);
                        if(
amount[1] == 1format(stringsizeof(string), "%s"shortstr);
                        if(
amount[1] != 1format(stringsizeof(string), "%s %s"stringshortstr);
                        if(
amount[0] == 6)
                        {
                           
strdel(stringstrlen(string)-1strlen(string));
                            
SendClientMessage(playerid0xFFFFFFFFstring);
                            
string "";
                            
amount[0] = 0;
                        }    
                }
        }
        
strdel(stringstrlen(string)-1strlen(string));
        if(
amount[0] != 0SendClientMessage(playerid0xFFFFFFFFstring);
        return 
1;

you're welcome


Re: /members Command - Konstantinos - 21.02.2014

Quote:
Originally Posted by FilesMAker
Посмотреть сообщение
You need to make a boucle.
Код:
SendClientMessage(playerid, Colour, "--------| Member and Stuff |--------");
for(new i; i<MAX_PLAYERS; i++)
{ 
      if(!IsPlayerConnected(i)) return 0;
      if(PlayerInfo[i][pMember] > 0) SendClientMessage(playerid, Colour, Message);
}
SendClientMessage(playerid, Colour, "------------------------------------");
You can add your style
Returning 0 will break the loop, something we don't want. Use continue; instead. Showing a message is not something the author asked either. You should format a string with the player's name.

I'd make it for you but I don't know how pMember and pLeader work (not a rp fan).


Re: /members Command - FilesMAker - 21.02.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Returning 0 will break the loop, something we don't want. Use continue; instead. Showing a message is not something the author asked either. You should format a string with the player's name.

I'd make it for you but I don't know how pMember and pLeader work (not a rp fan).
You are right Konstantinos, You are so skilled on scripting as your Reps says


Re: /members Command - Brandon_More - 21.02.2014

pawn Код:
COMMAND:members(playerid)
{
    if(PlayerInfo[playerid][faction] != -1)
    {
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][faction] != PlayerInfo[playerid][faction]) continue; // Breaks ID if someone isn't in your faction
            if(i == playerid) continue; // Breaks your own ID
            new Strings[250];
            format(Strings, sizeof(Strins), " - %s", PlayerName(i));
            SendClientMessage(playerid, COLOR_WHITE, Strings);
            return 1;
        }
    }
    else return SendClientMessage(playerid, "{ff0000}[ERROR]{ffffff} You cannot use this command");
}