setlevel problem.
#1

Hey, my setlevel command works good, but I found a bug ingame, I wasnt Admin level 5/6 but I tried /setlevel 0 6. And I was promoted.. But Only admin level 5/6 can promote peoples..

But, I have already a check if a player is level 5 or 6..

Can anyone found any problem?

pawn Код:
CMD:setlevel(playerid, params[])
{
    new str[128], id, alevel;
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] >= 5,6 || IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", id, alevel)) return SendClientMessage(playerid, COLOR_ORANGE, "You must be type /setlevel <playerid> <level>");
        if(alevel > 6 || alevel < 0) return SendClientMessage(playerid, COLOR_ORANGE, "There are 6 admin levels avabaile.");
        if(alevel == PlayerAcc[id][Admin]) return SendClientMessage(playerid, COLOR_RED, "That player is already in that admin level!");
        if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
        if(PlayerAcc[id][Admin] > alevel) GameTextForPlayer(id, "~r~Demoted!", 3000, 3);
        if(PlayerAcc[id][Admin] < alevel) GameTextForPlayer(id, "~g~Promoted!", 3000, 3);
        switch(alevel)
        {
            case 0: AdminRank = "Trusted Player";
            case 1: AdminRank = "Co-Mod";
            case 2: AdminRank = "Mod";
            case 3: AdminRank = "Trial Admin";
            case 4: AdminRank = "Admin";
            case 5: AdminRank = "Manager";
            case 6: AdminRank = "Owner";
        }
        PlayerAcc[id][Admin] = alevel;
        format(str, sizeof(str), "You set %s(ID:%d) Admin Level to %d - %s", GetName(id), id, alevel, AdminRank);
        SendClientMessage(playerid, 0xFFF700FF, str);
        format(str, sizeof(str), "Admin %s(ID:%d) has set your Admin Level to %d - %s", GetName(playerid), playerid, alevel, AdminRank);
        SendClientMessage(id, 0x00FF00FF, str);
    }
    else return ErrorMessages(playerid, 9);
    return 1;
}
Reply
#2

Simply you were logged in /RCON admin, because it says you must be level 5 or 6 on the admin system OR an RCON admin.
Reply
#3

but how to fix it?
Reply
#4

Just change this line:

pawn Код:
if(PlayerAcc[playerid][Admin] >= 5,6 || IsPlayerAdmin(playerid))

For this one:

pawn Код:
if(PlayerAcc[playerid][Admin] >= 5)
Reply
#5

Thank you man! +rep for you,

One thing..

I have a command that must be for admins level 1..

But normal players can do that to..

pawn Код:
CMD:spss(playerid, params[])
{
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] >= 1)
    GetPlayerVelocity(playerid, x1, y1, z1);
    SetPlayerVelocity(playerid, x1, y1, z1+ 0.3);
    SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully enabled super jump. /spsss to turn it off.");        jumper[playerid]=true;
    return 1;
}
Reply
#6

Already helped him, but he's asked me to remove it .
Reply
#7

Quote:
Originally Posted by mickos
Посмотреть сообщение
Thank you man! +rep for you,

One thing..

I have a command that must be for admins level 1..

But normal players can do that to..

pawn Код:
CMD:spss(playerid, params[])
{
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] >= 1)
    GetPlayerVelocity(playerid, x1, y1, z1);
    SetPlayerVelocity(playerid, x1, y1, z1+ 0.3);
    SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully enabled super jump. /spsss to turn it off.");        jumper[playerid]=true;
    return 1;
}
pawn Код:
CMD:spss(playerid, params[])
{
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] == 0) return SendClientMessage(playerid,-1,"Not admin");
    GetPlayerVelocity(playerid, x1, y1, z1);
    SetPlayerVelocity(playerid, x1, y1, z1+ 0.3);
    SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully enabled super jump. /spsss to turn it off.");        jumper[playerid]=true;
    return 1;
}
Reply
#8

But dont I need a check if a player is admin level 1?
Reply
#9

Do you reset the variables in OnPlayerConnect callback?
Reply
#10

It works thank you guys, +rep for 'ya all!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)