[HELP] Place / Admins in Dialog
#7

Alright then, seems that you can't understand my bad explanation, I'll do the most of the work for you with explanation.
pawn Код:
#define DIALOG_ADMINS 1000 //Put this somewhere before this command. The best is the top of your script.

//The above define is to make a proper name for the dialog. We will use this when we create a dialog,
//so that we can give it an ID that is needed by SA-MP.
if(!strcmp(cmdtext, "/admins", true))
{
    new count=0;
    new str[2048];//Put these outside the loop as we need to use the same string inside the loop.
    //We need a long string so that we can put all the names together.
    new pname[MAX_PLAYER_NAME];//Using MAX_PLAYER_NAME can prevent any problem
    //if SA-MP changes the maximum allowed length of player's name.
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
            if(admin[i])
            {              
                GetPlayerName(i, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), PASTA_CONTAS, pname);//I don't know what this is, so I leave it as it is.
                switch(pAdmin[i])
                {
                    case 1: format(str,sizeof(str),"%s{21E000}%s (%d) :: {21E000}[Tutor]",str,pname,i);
                    case 2: format(str,sizeof(str),"%s{3838FF}%s (%d) :: {3838FF}[Administrador]",str,pname,i);
                    //Do the same thing for the remaining 3 levels.
                }
            }
            count++;
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Vermelho, "(ERRO) Nao ha administradores online no momento");
    }
    else
    {
        //Use either DIALOG_STYLE_MSGBOX or DIALOG_STYLE_LIST below. I use DIALOG_STYLE_MSGBOX as an example.
        //If you think the message box is too small for 1024x768, you may use DIALOG_STYLE_LIST.
        ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"(Your title)",str,"Button1","Button2(leave this blank if you only want 1 button)");
    }
}
return 1;
}
Hope you understand this time, and you won't just copy and paste without asking why it work.
Reply


Messages In This Thread
[HELP] Place / Admins in Dialog - by xRuffles - 24.02.2013, 18:40
Re: [HELP] Place / Admins in Dialog - by leong124 - 24.02.2013, 19:04
Re: [HELP] Place / Admins in Dialog - by xRuffles - 25.02.2013, 09:22
Re: [HELP] Place / Admins in Dialog - by Gamer_007 - 25.02.2013, 09:26
Re: [HELP] Place / Admins in Dialog - by leong124 - 25.02.2013, 12:06
Re: [HELP] Place / Admins in Dialog - by xRuffles - 26.02.2013, 12:46
Re: [HELP] Place / Admins in Dialog - by leong124 - 26.02.2013, 15:51
Re: [HELP] Place / Admins in Dialog - by xRuffles - 27.02.2013, 14:13
Re: [HELP] Place / Admins in Dialog - by mittukuttan - 27.02.2013, 14:21
Re: [HELP] Place / Admins in Dialog - by leong124 - 27.02.2013, 18:02

Forum Jump:


Users browsing this thread: 1 Guest(s)