PlayerInfo[playerid][pMember] and PlayerInfo[playerid][pLeader]
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, "------------------------------------");
dcmd_members(playerid, params[])
{
new amount[2], string[200], shortstr[55], pname[24];
SendClientMessage(playerid, 0xFFFFFFFF, "Group members online:");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
amount[0] ++;
amount[1] ++;
GetPlayerName(i, pname, 24);
if(PlayerInfo[playerid][pLeader] != i) format(shortstr, sizeof(shortstr), "%s(%d),", pname, x);
if(PlayerInfo[playerid][pLeader] == i) format(shortstr, sizeof(shortstr), "[LEADER] %s(%d),", pname, x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 6)
{
strdel(string, strlen(string)-1, strlen(string));
SendClientMessage(playerid, 0xFFFFFFFF, string);
string = "";
amount[0] = 0;
}
}
}
strdel(string, strlen(string)-1, strlen(string));
if(amount[0] != 0) SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
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, "------------------------------------"); |
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). |
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");
}