/omakeadmin bug
#1

pawn Код:
if(strcmp(cmd, "/omakeadmin", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 100000)
        {
            new namestr[128];
            new lvlstr[128];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /omakeadmin [full name(case sensative)] [level]");
                return 1;
            }
            format(namestr, sizeof(namestr), "%s.ini",tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /omakeadmin [full name(case sensative)] [level]");
                return 1;
            }
            format(lvlstr, sizeof(lvlstr), "%s",tmp);
            //namecheck
            new playername[MAX_PLAYER_NAME];
            new strName[128];
            strmid(strName, namestr, 0, strlen(namestr)-4, 255); //remove .ini from string
//              for(new i = 0; i < MAX_PLAYERS; i++)
            foreach (Player, i)
            {
                GetPlayerRPName(i, playername, sizeof(playername));
                if(strcmp(playername, strName, true) == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "   That player is currently connected to the server !");
                    return 1;
                }
            }
            //
            if(dini_Exists(namestr))
            {
                format(string, sizeof(string), "{F00000}AdmCmd{FFFFFF}: %s's admin level has been changed to '%s'", namestr, lvlstr);
                SendClientMessage(playerid, COLOR_WHITE, string);
                Encrypt(lvlstr);
                dini_Set(namestr, "AdminLvl", lvlstr);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   That player does not exist !");
            }
        }
    }
I made this but the only bug is.....when i /omakeadmin Name_Surname 1337 or /omakeadmin 606
it sets it AdminLvl= 1557 or 628 from the 606 on the Name_Surname.-.- i dont understand where is the probleml, can anyone help?
Reply
#2

nvm
Encrypt(lvlstr);
it was cause of this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)