/admins in dialog
#1

Hello everyone,i have /admins command that shows online admins in chat,but i want to make it to be in dialog
Here's my command
PHP код:
CMD:admins(playerid,params[])
{
SendClientMessage(playerid,COLOR_RED,"**____________VORTEX-SAMP ADMINS____________**");
new 
j;
GetPlayerPoolSize();
for(new 
id=0;id<=j;id++)
{
GetPlayerName(id,name,sizeof(name));
format(iname,sizeof(iname),"%s.ini",name);
if(
dini_Int(iname,"Admin")!=0)
{
new 
str[MAX_PLAYER_NAME+100];
format(str,sizeof(str),"Ник: {00FF00}%s {FF0000}Админ Ниво: {FFFF00}%d",name,dini_Int(iname,"Admin"));
SendClientMessage(playerid,COLOR_ORANGE,str);
}
}
return 
1;

So i want to make this command to show online admins in dialog(the non selectable dialog).
I'll be really thankful if anyone help me!
Reply
#2

maybe like this?

PHP код:
CMD:admins(playeridparams[])
{
    new 
string[1024],string1[512],total 0;
    foreach(new 
Player)
    {
        if(
IsPlayerConnected(i))
            {
            if(
PlayerInfo[i][pAdmin] > 1)
                {
                new 
admin[20];
                if(
PlayerInfo[i][pAdmin] == 1) { admin "Admin"; }
                else if(
PlayerInfo[i][pAdmin] == 2) { admin "Moderator"; }
                else if(
PlayerInfo[i][pAdmin] == 3) { admin "Administrator"; }
                else if(
PlayerInfo[i][pAdmin] == 4) { admin "Main Administrator"; }
                else if(
PlayerInfo[i][pAdmin] == 5) { admin "Developer"; }
                if(
PlayerInfo[i][pAdmin] >= total++;
                new 
sendername[MAX_PLAYER_NAME];
                
GetPlayerName(isendernamesizeof(sendername));
                
format(string1024"%s\n{00CCFF}%s: {FFFFFF}%s (ID: %d) Status:{00ff00} Online",stringadminsendernamei);
                }
            }
    }
       
format(string1,512,"Admins Online: {ff3300}%d",total);
    
ShowPlayerDialog(playerid65535DIALOG_STYLE_MSGBOXstring1string"Close""");
    return 
1;

Reply
#3

PHP код:
playername(playerid)
{
 new 
pname[MAX_PLAYER_NAME];
 
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
 return 
pname;
}
CMD:admins(playerid)
{
    new 
count 0;
    new 
str[200];
    for(new 
ii<MAX_PLAYERS;i++)
    {
        if(
MakeVariableOfAdmin[i] > 0)
        {
            
format(strsizeof str"%s[%d] || Admin Level: %d\n""Close"""playername(i), iMakeVariableOfAdmin[i]);
            
ShowPlayerDialog(playerid1DIALOG_STYLE_MSGBOX"Current online Admins:"str"""Close");
            
count++;
        }
    }
    if (
count == 0ShowPlayerDialog(playerid1DIALOG_STYLE_MSGBOX"Current online Admins:""No admins online\n_____________________""Close""");
    return 
1;

Reply
#4

PHP код:
new arrAdminRanks[][]={"Admin","Moderator","Moderator","Administrator","Main Administrator","Developer"};
GetUserName(p){
    new 
s[20];
    
GetPlayerName(p,s,20);
    return 
s;
}
CMD:admins(p){
    new 
s[1024],
        
s2[20],
        
cnt;
    foreach(new 
Player){
        if(!
PlayerInfo[i][pAdmin])continue;
        
cnt++;
        
format(s,1024,"%s%d | %s | %s\n",s,cnt,arrAdminRanks[PlayerInfo[i][pAdmin]],GetUserName(i));
    }
    
format(s2,20,"Admins online - %d",cnt);
    
ShowPlayerDialog(p,d_admins,DIALOG_STYLE_MSGBOX,s2,s,"Close","");
    return 
1;

Reply
#5

thanks alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)