SA-MP Forums Archive
Problems with easy 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: Problems with easy command (/showthread.php?tid=403118)



Problems with easy command - FL3GM4 - 29.12.2012

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 ..


Re: Problems with easy command - Threshold - 29.12.2012

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.