Dialog /admins
#1

How to make this command to dialog.

Код:
	if (strcmp(cmd, "/admins", true) == 0) // Admin list if they're online
	{
	    new string[64],pName[MAX_PLAYER_NAME];
		GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
		format(string,sizeof string,"ADMIN: %s has viewed admin list (/admins)",pName);
		SendClientMessageToAdmins(DARKPINK, string, 1);
	    new count = 0;
		SendClientMessage(playerid, GREEN, "[Online Admins]");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
		    if (IsPlayerConnected(i))
	  		{
  				if(AccountInfo[i][AdminLevel] >= 1 && AccountInfo[i][AdminLevel] <= 5 && Hide[i] == 0)
	    		{
					GetPlayerName(i, sendername, sizeof(sendername));
					format(string, 128, "Level %d [%i]%s", AccountInfo[i][AdminLevel],i,sendername);
					SendClientMessage(playerid, RED, string);
					count++;
				}
			}
		}
		if (count == 0) SendClientMessage(playerid,RED,"No admin online in the list");
		SendClientMessage(playerid, GREEN, "[____________________________________]");
		return 1;
	}
Reply
#2

Try this:

pawn Код:
if (strcmp(cmd, "/admins", true) == 0) // Admin list if they're online
    {
        new string[128];
        new string1[1025];
        new pname[MAX_PLAYER_NAME];
        for(new i = 0; i < GetMaxPlayers(); i++)
        {
            GetPlayerName(i,pname,sizeof(pname));
            if(AccountInfo[i][AdminLevel] > 0)
            {
                format(string1,sizeof(string1),"Name: %s Level: %d ID: %i",pname,AccountInfo[i][AdminLevel],i);
                format(string,sizeof(string),"Admins Online\n\n%s\n",string1);
                ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Online Admins",string,"Okay","Close");
            }
            else
            {
                ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Online Admins","No administrators online","Okay","Close");
            }
        }
        return 1;
    }
Reply
#3

Something is wrong .
Im logged in but it says no administrators online.
Reply
#4

Change

pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
to

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#5

Still nothing.
Reply
#6

pawn Код:
if (strcmp(cmd, "/admins", true) == 0) // Admin list if they're online
{
    new string[256];
    new pname[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        GetPlayerName(i,pname,sizeof(pname));
        if(AccountInfo[i][AdminLevel] > 0)
        {
            format(string,sizeof(string),"[ONLINE]: Name: %s Level: %d ID: %i\n",pname,AccountInfo[i][AdminLevel],i);
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Online Admins",string,"Okay","Close");
        }
    }
    return 1;
}
try that.
Reply
#7

Still something is wrong.
If there is 2 admins online , then it will show only 1.
Reply
#8

CMD:
pawn Код:
if (strcmp(cmd, "/admins", true) == 0) // Admin list if they're online
{
    new admin = 0;
    new str[256];
    foreach(petla, i)
    {
        if(AccountInfo[i][AdminLevel] > 0)
        {
            format(str,sizeof(str),"%sADMIN %d %d   %s\n", str, AccountInfo[i][AdminLevel], i, NickName(i));
            admin++;
        }
    }
    if(admin >= 1)
        ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_LIST, "Admins Online:", str, "Okey", "Close");
    if(admin == 0)
        GameTextForPlayer(playerid, "~r~No admins ~w~online", 3000, 3);
    return 1;
}
Up:
pawn Код:
#define foreach(%1,%2) for (new %2 = 0; %2 < GetMaxPlayers(); %2++) if (IsPlayerConnected(%2)&&!IsPlayerNPC(%2))
Down:
pawn Код:
stock NickName(playerid)
{
    new playername[17];
    GetPlayerName(playerid, playername, 17);
    return playername;
}
Reply
#9

Thank u very much .
Reply
#10

can you help me ?

Im using LA-RP btw and i want to add gamesters & admins in dialog.

Here is command:
pawn Код:
if (strcmp(cmd, "/admins", true) == 0 || strcmp(cmd, "/admini", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_YELLOW, " ");
            SendClientMessage(playerid, COLOR_GREEN, "-|Admins|-");
            foreach (Player, i)
            {
                if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1341 || PlayerInfo[i][pGm] >=1)
                {
                    new admtext[64];
                    if(PlayerInfo[i][pAdmin] == 1340) { admtext = "Vlasnik"; }
                    else if(PlayerInfo[i][pAdmin] == 1339) { admtext = "Suvlasnik"; }
                    else if(PlayerInfo[i][pAdmin] == 1338) { admtext = "Admin Level 6"; }
                    else if(PlayerInfo[i][pAdmin] == 1337) { 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"; }
                    else if(PlayerInfo[i][pGm] == 1) { admtext = "GameMaster"; }
                    else { admtext = "Gamemoderator"; }
                    GetPlayerName(i, sendername, sizeof(sendername));
                    if(AdminDuty[i] == 1)
                    {
                        format(string, 256, "%s ( %s )", sendername, admtext);
                        SendClientMessage(playerid, COLOR_YELLOW, string);
                    }
                    else if(GmDuty[i] == 1)
                    {
                        format(string, 256, "%s ( %s )", sendername, admtext);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                    else
                    {
                        format(string, 256, "%s ( %s )", sendername, admtext);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                }
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)