SA-MP Forums Archive
Command /admins help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command /admins help! (/showthread.php?tid=583049)



Command /admins help! - ChristolisTV - 25.07.2015

Hello guys!

I am creating my own Admin System and I need help! Please! So the problem is that when I am alone on the server I type /admins and it says that I am Level 4. But when someone joins my server I type /admins and it shows
that HE is Level 4! Please help as fast as you can!

My script:
PHP код:
CMD:admins(playerid,params[]){
    new 
str[256],DIALOG[999],name[MAX_PLAYER_NAME],count=0;
    for(new 
p=0p<MAX_PLAYERSp++){
        if(
IsConnect(p)){
            if(
P_DATA[playerid][alevel] > 0){
                
GetPlayerName(p,name,sizeof(name));
                switch(
P_DATA[playerid][alevel]){
                    case 
1:format(str,sizeof(str),"{FFFFFF}Player:{FF9900} %s{FFFFFF} |{FFFFFF} Rank:{FF9900} Moderator{FFFFFF} |{FFFFFF} Level:{FF9900} %d",name,P_DATA[playerid][alevel]);
                    case 
2:format(str,sizeof(str),"{FFFFFF}Player:{FF9900} %s{FFFFFF} |{FFFFFF} Rank:{FF9900} Admin{FFFFFF} |{FFFFFF} Level:{FF9900} %d",name,P_DATA[playerid][alevel]);
                    case 
3:format(str,sizeof(str),"{FFFFFF}Player:{FF9900} %s{FFFFFF} |{FFFFFF} Rank:{FF9900} Co-Owner{FFFFFF} |{FFFFFF} Level:{FF9900} %d",name,P_DATA[playerid][alevel]);
                    case 
4:format(str,sizeof(str),"{FFFFFF}Player:{FF9900} %s{FFFFFF} |{FFFFFF} Rank:{FF9900} Owner{FFFFFF} |{FFFFFF} Level:{FF9900} %d",name,P_DATA[playerid][alevel]);
                }
                if(
IsPlayerAdmin(p))format(str,sizeof(str),"{FFFFFF}Player:{FF9900} %s{FFFFFF} |{FFFFFF} Rank:{FF9900} Owner{FFFFFF} |{FFFFFF} Level:{FF9900} %d",name,P_DATA[playerid][alevel]);
                
strcat(DIALOG,str);
                
count+=1;
            }
        }
    }
    if(
count 0)return SPD(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"{FF0000}Online Admins",str,"Close","");
    else return 
SPD(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"{FF0000}Online Admins","{FF0000}No admins online!","Close","");




Re: Command /admins help! - ChristolisTV - 25.07.2015

Anyone?


AW: Command /admins help! - Mencent - 25.07.2015

Hello!

Try this:
PHP код:
CMD:admins(playerid,params[])
{
    new 
str[999],name[MAX_PLAYER_NAME],bool:count;
    for(new 
p;p<MAX_PLAYERS;p++)
    {
        if(
IsConnect(p))
        {
            
GetPlayerName(p,name,sizeof name);
            switch(
P_DATA[p][alevel])
            {
                case 
1:format(str,sizeof str,"%s{FFFFFF}Player:{FF9900} %s{FFFFFF} | Rank:{FF9900} Moderator{FFFFFF} | Level: {FF9900}%d\n",str,name,P_DATA[p][alevel]);
                case 
2:format(str,sizeof str,"%s{FFFFFF}Player:{FF9900} %s{FFFFFF} | Rank:{FF9900} Admin{FFFFFF} | Level:{FF9900} %d\n",str,name,P_DATA[p][alevel]);
                case 
3:format(str,sizeof str,"%s{FFFFFF}Player:{FF9900} %s{FFFFFF} | Rank:{FF9900} Co-Owner{FFFFFF} | Level:{FF9900} %d\n",str,name,P_DATA[p][alevel]);
                case 
4:format(str,sizeof str,"%s{FFFFFF}Player:{FF9900} %s{FFFFFF} | Rank:{FF9900} Owner{FFFFFF} | Level:{FF9900} %d\n",str,name,P_DATA[p][alevel]);
            }
            if(
IsPlayerAdmin(p))format(str,sizeof str,"%s{FFFFFF}Player:{FF9900} %s{FFFFFF} | Rank:{FF9900} Owner(RCON){FFFFFF} | Level:{FF9900} %d\n",name,P_DATA[p][alevel]);
            
count true;
        }
    }
    if(
count == false)SPD(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"{FF0000}Online Admins","{FF0000}No admins online!","Close","");
    else 
SPD(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"{FF0000}Online Admins",str,"Close","");
    return 
1;

- Mencent


Re: Command /admins help! - ChristolisTV - 25.07.2015

Thank you again mate!