if(!strcmp(cmdtext, "/admins", true)) { new count=0; for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)){ if(admin[i]){ new str[256]; new pname[24]; GetPlayerName(i, pname, 24); format(file2, sizeof(file2), PASTA_CONTAS, pname); if(pAdmin[i] == 1){ format(str,sizeof(str),"{21E000}%s (%d) :: {21E000}[Tutor]", pname,i); } if(pAdmin[i] == 2){ format(str,sizeof(str),"{3838FF}%s (%d) :: {3838FF}[Administrador]", pname,i); } if(pAdmin[i] == 3){ format(str,sizeof(str),"{E5FF00}%s (%d) :: {E5FF00}[Administrador Senior]", pname,i); } if(pAdmin[i] == 4){ format(str,sizeof(str),"{7418FF}%s (%d) :: {7418FF}[Sub-Dono]", pname,i); } if(pAdmin[i] == 5){ format(str,sizeof(str),"{F80018}%s (%d) :: {F80018}[Dono]", pname,i); } SendClientMessage(playerid, 0x0080FFAA, str); count++; } } } if(count == 0) { SendClientMessage(playerid, Vermelho, "(ERRO) Nгo hб administradores online no momento"); } return 1; }
new string[2048] = "";//Initialisation is important here
format(string, sizeof(string), "%sBlaBlaBla(name or something)\n", string, (your parameters) );
ShowPlayerDialog(playerid, dialog id, dialog style(I like DIALOG_STYLE_LIST but DIALOG_STYLE_MSGBOX is also possible), caption/title , content of the dialog (you string), button1, button2);
if(!strcmp(cmdtext, "/admins", true))
{
new count=0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)){
if(admin[i]){
new str[256];
new pname[24];
GetPlayerName(i, pname, 24);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
if(pAdmin[i] == 1){
format(str,sizeof(str),"{21E000}%s (%d) :: {21E000}[Tutor]", pname,i);
}
if(pAdmin[i] == 2){
format(str,sizeof(str),"{3838FF}%s (%d) :: {3838FF}[Administrador]", pname,i);
}
if(pAdmin[i] == 3){
format(str,sizeof(str),"{E5FF00}%s (%d) :: {E5FF00}[Administrador Senior]", pname,i);
}
if(pAdmin[i] == 4){
format(str,sizeof(str),"{7418FF}%s (%d) :: {7418FF}[Sub-Dono]", pname,i);
}
if(pAdmin[i] == 5){
format(str,sizeof(str),"{F80018}%s (%d) :: {F80018}[Dono]", pname,i);
}
ShowPlayerDialog(playerid,16, DIALOG_STYLE_MSGBOX, "{FF0000}Online Admins:",str, "OK", "Cancel");
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, Vermelho, "(ERRO) Nгo hб administradores online no momento");
}
return 1;
}
Well as I'm Newbie What you do not understand this much explaining to me how you would help me make the Code?
|
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;
}