/admins(dialog) HELP!
#1

(11325) : error 010: invalid function or declaration

Code:
dcmd_admins(playerid, params[])
{
    #pragma unused params
    new string[2048];
    new sendername[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PInfo[playerid][Level] >= 3)
    {
    GetPlayerName(i , sendername, sizeof(sendername));
    format(string, sizeof(string),"The following admin(s) are currently online:\n  %s %s (ID:%d): [Level %i]\n", string,sendername, i,PInfo[playerid][Level]);
    }
    }
    }
    ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Victim Online Admins List...",string,"OK","Cancel");
    }
    else
    {
    ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Victim Online Admins List...","No administrators online","OK","Cancel");
    }
    }
    return 1; << 11325
}
Reply
#2

Code:
dcmd_admins(playerid, params[])
{
    #pragma unused params
    new string[2048];
    new sendername[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
   	{
    	for (new i = 0; i < MAX_PLAYERS; i++)
    	{
    		if(IsPlayerConnected(i))
    		{
    			if(PInfo[playerid][Level] >= 3)
    			{
    				GetPlayerName(i , sendername, sizeof(sendername));
    				format(string, sizeof(string),"The following admin(s) are currently online:\n  %s %s (ID:%d): [Level %i]\n", string,sendername, i,PInfo[playerid][Level]);
    			}
    		}
    	}
    	ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Victim Online Admins List...",string,"OK","Cancel");
	}
    else
    {
    	ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Victim Online Admins List...","No administrators online","OK","Cancel");
    }
    return 1
}
Reply
#3

EDIT: To late... why!

You had one extra bracket above return 1;

Plus, properly indent your code, this looks like horse shit. And use [ pawn] and [ /pawn] tags.

pawn Code:
dcmd_admins(playerid, params[])
{
    #pragma unused params
    new string[2048];
    new sendername[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PInfo[playerid][Level] >= 3)
                {
                    GetPlayerName(i , sendername, sizeof(sendername));
                    format(string, sizeof(string),"The following admin(s) are currently online:\n  %s %s (ID:%d): [Level %i]\n", string,sendername, i,PInfo[playerid][Level]);
                }
            }
        }
        ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Victim Online Admins List...",string,"OK","Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Victim Online Admins List...","No administrators online","OK","Cancel");
    }
    return 1;
}
Reply
#4

Thanks
Reply
#5

Ohh, and btw, the way you are doing this would probably not work. If I am correct (could be wrong, tired) you are checking if YOU are admin, and then you are formatting YOUR own variable into the string.

And also, the way you are doing this would not show more than one admin (if correct), considering you are formatting the string over and over again, so it does not save the last string. You can use strcat to add onto a string, which is recommended.
Reply
#6

:\ ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"O nline Admins List...","No administrators online","OK","Cancel");

I cant see it the dialog its not showing
Reply
#7

Obviously. You are checking if the player is connected, and if YOU aren't connected, it will show the dialog.
Reply
#8

:\ can someone fix it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)