CMD:admins
#1

Код:
CMD:admins(playerid, params[])
{
	new count = 0,
		string[128];
    foreach (new i : Player) if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminHide] < 1)
	{
        if (PlayerData[i][pAdminDuty])
			format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {01DF01}(On Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]);

		else
		    format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {DF0101}(Off Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]);

        count++;
	}
	if (!count) {
	    format(string,sizeof(string), "There's no online Administrators.");
	}
	Dialog_Show(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", "");
	return 1;
}
When I type /admins..it only show me if I am administrator, I cant see other administrators, wtf?
Reply
#2

Maybe try this replacing:
pawn Код:
foreach (new i : Player) // OLD

new count = 0, i;
foreach(Player, i) // NEW
Maybe it`s not working, becouse I haven`t scripted for a long time ago.
Othervise I have my version here you got:
pawn Код:
CMD:admins(playerid, params[])
{
    new LongString[1024],ShortString[180],Count = 0;
    if(pInfo[playerid][pAdmin] <= 2)
    {
        foreach(Player, i)
        {
            if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
            {
                Count++;
                format(ShortString, sizeof(ShortString), embed_orange"%s "embed_white"[ "embed_orange"ID:%d"embed_white" ]\n", pName[i],i);
                strcat(LongString,ShortString);
            }
        }
    }
    else
    {
        foreach(Player, i)
        {
            if(pInfo[i][pAdmin] > 0)
            {
                Count++;
                format(ShortString, sizeof(ShortString), embed_orange"%s "embed_white"[ "embed_orange"ID:%d"embed_white"| %s "embed_white"]\n", pName[i],i, pInfo[i][pHide] ? (embed_red"Hide") : (embed_green"Dont Hide"));
                strcat(LongString,ShortString);
            }
        }
    }
    if(Count == 0) return ShowPlayerDialog(playerid, 1299, DIALOG_STYLE_MSGBOX ,embed_grey"Online Admins",embed_red"There is no admins online","Ok","");
    else return ShowPlayerDialog(playerid, 1299, DIALOG_STYLE_MSGBOX,embed_grey"Online Admins",LongString,"Ok","");
}
Reply
#3

Try this I tried a while ago

https://sampforum.blast.hk/showthread.php?tid=567792
Reply
#4

pawn Код:
CMD:admins(playerid, params[])
{
    new string[128];
    foreach(new i : Player)
    {
        if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminHide] < 1)
        {
            if(PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {01DF01}(On Duty)\n%s", ReturnName(i, 0), PlayerData[i][pAdmin],string);
            else format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {DF0101}(Off Duty)\n%s", ReturnName(i, 0), PlayerData[i][pAdmin],string);
        }
        else format(string,sizeof(string), "There's no online Administrators.");
    }
    Dialog_Show(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", "");
    return 1;
}
Reply
#5

C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : warning 215: expression has no effect
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 001: expected token: ";", but found "]"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 029: invalid expression, assumed zero
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : fatal error 107: too many error messages on one line

Code CMD:admins

Код:
CMD:admins(playerid, params[])
{
	new string[128];
	foreach(new i : Player)
	{
		if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
		{
	        if(PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {4BB74C}Administrating", ReturnName(i, 0), PlayerData[i][pAdmin],string);
			else format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {FF0000}Roleplaying", ReturnName(i, 0), PlayerData[i][pAdmin],string);
		}
		else format(string,sizeof(string), "There's no online Administrators.");
	}
	ShowPlayerDialog(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", "");
	return 1;
}
Error COde
Код:
if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
Reply
#6

Quote:
Originally Posted by Tihoy232
Посмотреть сообщение
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : warning 215: expression has no effect
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 001: expected token: ";", but found "]"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : error 029: invalid expression, assumed zero
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(37649) : fatal error 107: too many error messages on one line

Code CMD:admins

Код:
CMD:admins(playerid, params[])
{
	new string[128];
	foreach(new i : Player)
	{
		if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
		{
	        if(PlayerData[i][pAdminDuty]) format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {4BB74C}Administrating", ReturnName(i, 0), PlayerData[i][pAdmin],string);
			else format(string,sizeof(string), "%s(%s): %s(ID: %i) Status: {FF0000}Roleplaying", ReturnName(i, 0), PlayerData[i][pAdmin],string);
		}
		else format(string,sizeof(string), "There's no online Administrators.");
	}
	ShowPlayerDialog(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", "");
	return 1;
}
Error COde
Код:
if(pInfo[i][pAdmin] > 0 && pInfo[i][pHide] == 0)
You should add couple of things first..

Код:
enum pInfo
{
    pAdmin,
    pHidden
};

new PlayerInfo[MAX_PLAYERS][pInfo];
And so on..
Reply
#7

Quote:
Originally Posted by Connor Smith
Посмотреть сообщение
Код:
CMD:admins(playerid, params[])
{
	new count = 0,
		string[128];
    foreach (new i : Player) if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminHide] < 1)
	{
        if (PlayerData[i][pAdminDuty])
			format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {01DF01}(On Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]);

		else
		    format(string,sizeof(string), "%s\t{33CC33}(Level: %d)\t {DF0101}(Off Duty)\n", ReturnName(i, 0), PlayerData[i][pAdmin]);

        count++;
	}
	if (!count) {
	    format(string,sizeof(string), "There's no online Administrators.");
	}
	Dialog_Show(playerid, AdminList, DIALOG_STYLE_TABLIST, "Adminitrators", string, "OK", "");
	return 1;
}
When I type /admins..it only show me if I am administrator, I cant see other administrators, wtf?
increase size:
Код:
new count, string[1000]; //otherwise the more admins will be the problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)