CMD:clanovi(playerid, params[]) { new string[256];//It will add on to the string each time it finds a member, so you need a big-ish string. for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[playerid][Clan] == PlayerInfo[i][Clan]) { format(string, sizeof(string), "%s\n%s", string, PlayerName(i)); } } ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Member(s) online", string, "OK", ""); return 1; }
i wanna to make command for players in faction ("Clan") but i shows me all players online :/
Код:
CMD:clanovi(playerid, params[]) { new string[256];//It will add on to the string each time it finds a member, so you need a big-ish string. for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[playerid][Clan] == PlayerInfo[i][Clan]) { format(string, sizeof(string), "%s\n%s", string, PlayerName(i)); } } ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Member(s) online", string, "OK", ""); return 1; } |
CMD:clanovi(playerid, params[])
{
new string[256], count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[playerid][Clan] == PlayerInfo[i][Clan])
{
if(count == 0)
{
format(string, sizeof(string), "%s", PlayerName(i));
}
else
{
format(string, sizeof(string), "%s\n%s", string, PlayerName(i));
}
count++;
continue;
}
}
}
ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Member(s) online", string, "OK", "");
return 1;
}