/staff command problem
#1

Hey, i'm trying to make a command which shows all staff, just getting a error. Don't know what im doing wrong.

Код:
YCMD:staff(playerid, params[], help)
{
	if(help) return SCM(playerid, COLOR_GREY, "Not supported");

	new string[256], sendername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sendername, sizeof(sendername));
	if(IsPlayerConnected(playerid))
    {
        SCM(playerid, COLOR_YELLOW, "Admins");
		foreach(new i : Player)
		{
			if(IsPlayerConnected(i))
			{
			    if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
			    {
			        new admtext[64];
			        if(PlayerInfo[i][pAppearList] == 1 || PlayerInfo[i][pAppearList] == 0)
			        {
						if(PlayerInfo[i][pAdmin] == 6)	{ admtext = "Admin Level 6"; }
						else if(PlayerInfo[i][pAdmin] == 5) { admtext = "Admin Level 5"; }
						else if(PlayerInfo[i][pAdmin] == 4) { admtext = "Admin Level 4"; }
						else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Admin Level 3"; }
						else if(PlayerInfo[i][pAdmin] == 2)	{ admtext = "Admin Level 2"; }
						else if(PlayerInfo[i][pAdmin] == 1) { admtext = "Admin Level 1"; }
					}
					GetPlayerName(i, sendername, sizeof(sendername));
					if(PlayerInfo[i][pAdminDuty] == 0)
					{
						format(string, sizeof(string), "%s: %s", admtext, sendername);
						SCM(playerid, COLOR_GRAD, string);
					}
					else if(PlayerInfo[i][pAdminDuty] == 1)
					{
					    format(string, sizeof(string), "%s: %s - On Duty", admtext, sendername);
						SCM(playerid, COLOR_GRAD, string);
					}
				}
			}
		}
	if(IsPlayerConnected(playerid))
	{
		SCM(playerid, COLOR_YELLOW, "Mods");
		foreach(new i : Player)
		{
			if(IsPlayerConnected(i))
			{
			    if(PlayerInfo[i][pMod] == 1)
			    {
			        new admtext[64];
			        if(PlayerInfo[i][pAppearList] == 1 || PlayerInfo[i][pAppearList] == 0)
			        {
						if(PlayerInfo[i][pMod] == 1)	{ admtext = "Moderator"; }
					}
					GetPlayerName(i, sendername, sizeof(sendername));
					if(PlayerInfo[i][pModDuty] == 0)
					{
						format(string, sizeof(string), "%s: %s", admtext, sendername);
						SCM(playerid, COLOR_GRAD, string);
					}
					else if(PlayerInfo[i][pModDuty] == 1)
					{
					    format(string, sizeof(string), "%s: %s - On Duty", admtext, sendername);
						SCM(playerid, COLOR_GRAD, string);
					}
				}
			}
		}
	}
	return 1;
}
I got a single /admins and /mods command working, I just don't know how to get them in line, it needs to show the admins first then the moderators, how to do that?

Thanks!
Reply
#2

pawn Код:
YCMD:staff(playerid, params[], help)
{
    #pragma unused params
    if(help) return SCM(playerid, COLOR_GREY, "Not supported");
    SCM(playerid, COLOR_YELLOW, "Admins");
    new pName[MAX_PLAYER_NAME];
    foreach(new i : Player)
    {
        if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
        {
            new admtext[14];
            if(PlayerInfo[i][pAppearList] == 1 || PlayerInfo[i][pAppearList] == 0)
            {
                format(admtext, sizeof admtext, "Admin level %d", PlayerInfo[playerid][pAdmin]);
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "%s: %s %s", admtext, pName, (PlayerInfo[i][pAdminDuty] ? ("- On Duty") : ("")));
                SCM(playerid, COLOR_GRAD, string);
            }
        }
    }
    SCM(playerid, COLOR_YELLOW, "Mods");
    foreach(new i : Player)
    {
        if(PlayerInfo[i][pMod] == 1)
        {
            new admtext[10];
            if(PlayerInfo[i][pAppearList] == 1 || PlayerInfo[i][pAppearList] == 0)
            {
                if(PlayerInfo[i][pMod] == 1) { admtext = "Moderator"; }
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof string, "%s: %s %s", admtext, pName, (PlayerInfo[i][pModDuty] ? ("- On Duty") : ("")));
                SCM(playerid, COLOR_GRAD, string);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)