Problems with easy command
#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;
}
And how to make command for: /allmembers !? To show online and offline members in faction ..
Reply
#2

Quote:
Originally Posted by FL3GM4
Посмотреть сообщение
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;
}
And how to make command for: /allmembers !? To show online and offline members in faction ..
pawn Код:
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;
}
Give that a try.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)