02.07.2012, 16:52
Hello, how to make command that display all online admins in dialog style: DIALOG_STYLE_MSGBOX
I want every admin to be on new line.
I want every admin to be on new line.
CMD:admins(playerid,params[]) { new A_String[ 150 ], count = 0, AdminPos[ 30 ]; foreach(Player, i) { if( Bit4_Get( AdminLevel, i ) >= 1 || IsPlayerAdmin( i ) ) { if( Bit4_Get( AdminLevel, i ) == 1 ) AdminPos = ""#RED"Newbie Admin"; else if( Bit4_Get( AdminLevel, i ) == 2 ) AdminPos = ""#RED"Moderator"; else if( Bit4_Get( AdminLevel, i ) == 3 ) AdminPos = ""#RED"Administrator"; else if( Bit4_Get( AdminLevel, i ) == 4 ) AdminPos = ""#RED"Head Administrator"; else if( Bit4_Get( AdminLevel, i ) == 5 ) AdminPos = ""#RED"Server Owner"; else if( IsPlayerAdmin( i ) ) AdminPos = ""#RED"RCON Admin"; format( A_String, sizeof( A_String ),"%s"#GREEN"%s[ID:%d] "#YELLOW"- "#BLUE"%s \n", A_String, GetName( i ), i, AdminPos ); ShowPlayerDialog( i, A_D_ON , 0, ""#WHITE"Online Admins", A_String, "OK", "" ); count++; } else if( count == 0 ) { ShowPlayerDialog( i, A_D_ON, 0, "Admins Online", ""WHITE"No Admins Online!", "OK", "" ); } } return 1; }
admins[][] new a; new sting[]; for(new i;i == MAX_PLAYERS;i++) { if(IsPlayerAdmin(playerid)) { GetPlayerName(playerid,admins[a]); a++; } } for(new b == 01;b == a;b++) { format(string,sizeof(string),"%s %s",string,admins[a]); } ShowPlayerDialog(......); //Just print it.
if(strcmp(cmd, "/allhouses",true)==0)
{
new info[2000];
for(new i = 0; i < 30; i++)
{
if(HouseInfo[i][hOwned] == 0)
{
format(string,sizeof(string),"{00FF00}House ID %d: The House Is Free\n",i);
}
else
{
format(string,sizeof(string),"{FF8000}House ID %d: Owned by: %s\n",i,HouseInfo[i][hOwner]);
}
strcat(info, string, sizeof(info));
ShowPlayerDialog(playerid,17,DIALOG_STYLE_MSGBOX,"{0080FF}ALL HOUSES:",info,"Other","Close");
}
return 1;
}
if(strcmp(cmd, "/allhouses",true)==0)
{
new info[2000];
info[0] = '\0';
for(new i = 0; i < 30; i++)
{
if(HouseInfo[i][hOwned] == 0)
{
format(string,sizeof(string),"{00FF00}House ID %d: The House Is Free\n",i);
}
else
{
format(string,sizeof(string),"{FF8000}House ID %d: Owned by: %s\n",i,HouseInfo[i][hOwner]);
}
strcat(info, string, sizeof(info));
ShowPlayerDialog(playerid,17,DIALOG_STYLE_MSGBOX,"{0080FF}ALL HOUSES:",info,"Other","Close");
}
return 1;
}
if(strcmp(cmd, "/allhouses",true)==0)
{
if (PlayerInfo[playerid][pAdminLevel] >= 4)
{
new strings[256];
new info[2000];
info[0] = '\0';
for(new i = 0; i < 30; i++)
{
if(HouseInfo[i][hOwned] == 0)
{
format(string,sizeof(string),"{00FF00}House ID %d: The House Is Free\n",i);
}
else
{
format(strings, sizeof(strings), "%s.ini",HouseInfo[i][hOwner]);
if(dini_Exists(strings))
{
new s = dini_Int(strings, "Second");
new m = dini_Int(strings, "Minute");
new h = dini_Int(strings, "Hour");
new d = dini_Int(strings, "Day");
new mo = dini_Int(strings, "Month");
new y = dini_Int(strings, "Year");
format(string,sizeof(string),"{FF8000}House ID %d: Owner: %s, Last login: %s%d.%s%d.%d and %s%d:%s%d:%s%d PM!\n",i,HouseInfo[i][hOwner],(d < 10) ? ("0") : (""), d, (mo < 10) ? ("0") : (""), mo, y, (h < 10) ? ("0") : (""), h, (m < 10) ? ("0") : (""), m, (s < 10) ? ("0") : (""), s);
}
}
strcat(info, string, sizeof(info));
ShowPlayerDialog(playerid,17,DIALOG_STYLE_MSGBOX,"{0080FF}ALL HOUSES:",info,"Other","Close");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not admin!");
}
return 1;
}
format(string, sizeof(string), "Time %02d:%02d", hour, minute);