Hi, i need help with a command. I want an administrator command: /amembers [Faction Number]. If the administrator uses it, it will appears the member who are online of that faction. Example: /amembers 1, will appears something like this:
Etc..
But i don't know why it doesn't work. If you are in the National Guard and you use /amembers 1 to see SAPD's online, you will appear there :S I need help. This command is for the 0.3
Код:
if(strcmp(cmd, "/amembers", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USA: /amembers [Faction number]");
return 1;
}
new miembrofaccion = strval(tmp);
if (miembrofaccion == 1)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 1");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 2)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 2");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 3)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 3");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 4)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 4");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 5)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 5");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 6)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 6");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 7)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 7");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 8)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 8");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 9)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 9");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 10)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 10");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 11)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 11");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 12)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 12");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 13)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 13");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 14)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 14");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 15)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 15");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 16)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 16");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
if (miembrofaccion == 17)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0x808000AA, "- Members Online of: Faction 17");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "%s", sendername);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use this command!");
}
return 1;
}
}
return 1;
}
So the problem is that your name also pops up in every faction you want the players dispalyed of ?
For example. You are in the faction 3. If i use /amembers 1, you will appear there :S and if i use /amembers 3 you won't appear there.
As you can see you're checking if the player that typed the command is a member of the group, not if the player in the loop is a member of the group
Uhm.... that