Help please
#1

please im in a great problem in my /admins command in this command look at the commented part
pawn Код:
CMD:admins(playerid,params[]) {
    #pragma unused params
    new Count[2], i, string[128];
    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
    {
        if(PlayerInfo[i][Level] >= 1) Count[0]++;// problem is here when it is 1 only level 1 admins and abhove can use that no player can use that
        if(IsPlayerAdmin(i)) Count[1]++;
    }

    if( (Count[0] >= 7 && Count[1] >= 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][Level] >= 0) )
    return ShowPlayerDialog(playerid, 13412, DIALOG_STYLE_MSGBOX, "Online Admin List...", "No Admins Online", "Ok", "");

    if(Count[0] >= 1) {
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] >= 0) {
            format(string, sizeof(string), "Level: %d - %s (Id:%d)", PlayerInfo[i][Level], PlayerName2(i), i);

            ShowPlayerDialog(playerid, 4,DIALOG_STYLE_MSGBOX,"online admins...", string, "цk", "");

        }
    }

    if(Count[0] == 1) {
        new x; format(string, sizeof(string), "Admins: ");
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0)
        {
            format(string,sizeof(string),"Level: %d - %s (Id:%d)",string,i,PlayerName2(i),PlayerInfo[i][Level]);
            x++;
            if(x >= 5) {
                ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "Online admins...",string, "ok", ""); format(string, sizeof(string), "Admins: "); x = 0;
            }
            else format(string, sizeof(string), "%s,  ", string);
        }
        if(x <= 4 && x > 0) {
            string[strlen(string)-3] = '.';
            SendClientMessage(playerid, blue, string);
        }
    }

    if( (Count[1] == 1) && (PlayerInfo[playerid][Level] >= 0) ) {
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
            format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    if(Count[1] == 0) {
        new x; format(string, sizeof(string), "RCON Admins: ");
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
        {
            format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
            x++;
            if(x >= 5) {
                SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
            }
            else format(string, sizeof(string), "%s,  ", string);
        }
        if(x <= 4 && x > 0) {
            string[strlen(string)-3] = '.';
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    return 1;
}
if i change

Код:
if(PlayerInfo[i][Level] >= 1) Count[0]++;//
to
Код:
if(PlayerInfo[i][Level] >= 0) Count[0]++;//
look what happened

it is showing names of players with level 0 if i dont change that no player can use that only admins can use /admins command please help me
Reply
#2

Use this. Simple and with 5 Levels.
edit if you have diff level names or diff levels.
pawn Код:
CMD:admins(playerid,params[])
{
    new Count, string[128],n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "__________|Admins|__________");
    foreach(Player, i)
    {
        if(PlayerInfo[i][Level] ==1) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Global Moderator (Level 1) : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==2) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Moderator (Level 2) : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==3) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Administrator (Level 3) : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==4) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Head Administrator (Level 4) : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==5) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Server Owner (Level 5) : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
    }
    if(Count == 0) SendClientMessage(playerid, COLOR_LIGHTBLUE, "No Admins Online");
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________________________");
    return 1;
}
Reply
#3

i have 10 levels please make this accouring to that dont worry i will give you a + rep
Reply
#4

Ok, Name your Levels yourself.
pawn Код:
CMD:admins(playerid,params[])
{
    new Count, string[128],n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "__________|Admins|__________");
    foreach(Player, i)
    {
        if(PlayerInfo[i][Level] ==1) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 1 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==2) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 2 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==3) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 3 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==4) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 4 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==5) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 5 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==6) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 6 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==7) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 7 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==8) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 8 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==9) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 9 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
        if(PlayerInfo[i][Level] ==10) {
        GetPlayerName(i,n,sizeof(n));
        format(string,sizeof(string),"Level 10 : %s",n);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        Count++;
        }
    }
    if(Count == 0) SendClientMessage(playerid, COLOR_LIGHTBLUE, "No Admins Online");
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________________________");
    return 1;
}
Reply
#5

dont go offline cheaking
Reply
#6

can u please paste it without [code /code] normally please

Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 33 seconds.

Reply
#7

Here :

CMD:admins(playerid,params[])
{
new Count, string[128],n[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_LIGHTBLUE, "__________|Admins|__________");
foreach(Player, i)
{
if(PlayerInfo[i][Level] ==1) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 1 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==2) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 2 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==3) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 3 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==4) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 4 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==5) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 5 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==6) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 6 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==7) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 7 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==8) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 8 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==9) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 9 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[i][Level] ==10) {
GetPlayerName(i,n,sizeof(n));
format(string,sizeof(string),"Level 10 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
}
if(Count == 0) SendClientMessage(playerid, COLOR_LIGHTBLUE, "No Admins Online");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________________________");
return 1;
}
Reply
#8

man so many errors after putting that


Код:
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31217) : error 017: undefined symbol "foreach"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31219) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31220) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31225) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31226) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31231) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31232) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31237) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31238) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31243) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31244) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31249) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31250) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31255) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31256) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31261) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31262) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31267) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31268) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31273) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31274) : error 017: undefined symbol "i"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(37542) : warning 217: loose indentation
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(40912) : error 017: undefined symbol "foreach"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(40914) : error 017: undefined symbol "playerid"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(40917) : error 017: undefined symbol "playerid"
C:\Users\Rajan\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(51308) : warning 203: symbol is never used: "UD"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


24 Errors.
Reply
#9

Hmm. im Not getting any error?
Use this :


CMD:admins(playerid,params[])
{
new Count, string[128],n[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_LIGHTBLUE, "__________|Admins|__________");
foreach(Player, playerid)
{
if(PlayerInfo[playerid][Level] ==1) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 1 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==2) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 2 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==3) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 3 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==4) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 4 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==5) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 5 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==6) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 6 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==7) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 7 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] == {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 8 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==9) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 9 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
if(PlayerInfo[playerid][Level] ==10) {
GetPlayerName(playerid,n,sizeof(n));
format(string,sizeof(string),"Level 10 : %s",n);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
Count++;
}
}
if(Count == 0) SendClientMessage(playerid, COLOR_LIGHTBLUE, "No Admins Online");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________________________");
return 1;
}
Reply
#10

please help ijm the error is in those lines please.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)