My admin system is having a slight issue; I'll rep for help
#1

Hey guys, I'm having an issue with my /makeadmin command:

Код:
CMD:makeadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 99999) return SendClientMessage(playerid, -1, "You do not meet the admin level requirement to use this command!");
    new targetid, level;
    if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, -1, "/makeadmin [playerid/partofname] [level]");
    if(!(-1 < level < 100000)) return SendClientMessage(playerid, -1, "The max admin level is 99999!");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not currently online!");
    new alevel[20], astr[128], sendername[MAX_PLAYER_NAME];
    switch(level)
    {
        case 0:
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(astr, sizeof(astr), "You have been demoted by Admin %s", sendername);
            SendClientMessage(targetid, COLOR_RED, astr);
            GetPlayerName(targetid, sendername, sizeof(sendername));
            format(astr, sizeof(astr), "You have demoted %s of their Admin rank.", sendername);
            SendClientMessage(playerid, COLOR_RED, astr);
            PlayerInfo[targetid][pAdmin] = level;
            return 1;
        }
        case 1: alevel = "Moderator";
        case 2: alevel = "Junior Admin";
        case 3: alevel = "General Admin";
        case 4: alevel = "Senior Admin";
        case 5: alevel = "Lead Admin";
        case 6: alevel = "Head Admin";
        case 1337: alevel = "Executive Admin";
        case 9999: alevel = "Co-Owner";
        case 99999: alevel = "Owner";
        default: return SendClientMessage(playerid, -1, "You have entered an invalid level. (0 - 6, 1337, 9999 or 99999)");
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(astr, sizeof(astr), "You have been made into a %s by Admin %s!", alevel, sendername);
    SendClientMessage(targetid, COLOR_RED, astr);
    GetPlayerName(targetid, sendername, sizeof(sendername));
    format(astr, sizeof(astr), "You have made %s into a %s!", sendername, alevel);
    SendClientMessage(playerid, COLOR_RED, astr);
    PlayerInfo[targetid][pAdmin] = level;
    return 1;
}
That is the code. Now when I type /makeadmin and I've logged into Rcon, it says I haven't met the required admin level. And also, when it did work the first time I ever used it, I made myself level 99999 admin and for some reason it would again give me that message above unless I logged into Rcon. It's very odd and I'd like some help. If I need to post some other code; just tell me.
Reply
#2

pawn Код:
PlayerInfo[playerid][pAdmin]  <= 99999
If still buggy then just try to use "IsPlayerAdmin".
Reply
#3

Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
pawn Код:
PlayerInfo[playerid][pAdmin]  <= 99999
If still buggy then just try to use "IsPlayerAdmin".
If I were to do <= I couldn't use it as a level 99999 admin, and that's my main goal along with Rcon admins having access to it.
Reply
#4

Why don't you just make check if their admin level is equal to or greater than to be able to execute the command insted of checking if their admin level is lower. >= 5 then just else it at the bottom.
Reply
#5

Quote:
Originally Posted by K9IsGodly
Посмотреть сообщение
If I were to do <= I couldn't use it as a level 99999 admin, and that's my main goal along with Rcon admins having access to it.
Uhm,

You defined two opposite directions, You defined this, If player is logged in as RCON and he is having less than 99999 admin level.
Here you didn't allowed rcon to use your command .

So, Just change < to > and in place of return use 'else'.
Try first!
Reply
#6

Quote:
Originally Posted by (*|Flake|*)
Посмотреть сообщение
Why don't you just make check if their admin level is equal to or greater than to be able to execute the command insted of checking if their admin level is lower. >= 5 then just else it at the bottom.
Decided to do this; worked great. Thanks for all of your replies.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)