Set Level not saving
#1

Ok so i tried to save /setlevel but it doesnt get to the mysql database.. So whats wrong with this:
pawn Код:
COMMAND:setlevel(playerid,  params[])
{
    new string[128],string2[128], OtherPlayer, Level, promote[128], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
    format(string, sizeof(string), "SELECT Admin FROM Users WHERE Name = '%s'", UserStats[playerid][Name]);
    mysql_query(string);
   
    if (sscanf(params, "ui", OtherPlayer, Level)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setlevel <OtherPlayer> <AdminLevel>\"");
    else
    {
        if(UserStats[playerid][Admin] == 5)
        {      
            if(Level <= 5)
                {
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(OtherPlayer, name2, sizeof(name2));
                UserStats[OtherPlayer][Admin] = Level;
                format(string2, sizeof(string2), "UPDATE Users SET `Admin`= '%i' WHERE Name = '%s'", Level, name2);
                mysql_query(string2);
                format(promote, sizeof(promote), "{00FF00}Admin %s has promoted %s to level %i", name, name2, Level);
                SendClientMessageToAll(0xFFFFFF, promote);
                SavePlayer(OtherPlayer);
               
            }
            else
            {
                SendClientMessage(playerid, 0xFFFFFFF, "{FF0000}Maximum level is 5!");
                return 0;
            }
        }
   
    }
    return 1;
}
Please help thanks!
Reply
#2

BUMP help please! whats wrong
Reply
#3

Wtf? Explain better...
It doesn't set the admin level on the database? Or it doesn't get the admin level before if(sscanf...?
Reply
#4

Well it doesnt set the admin level in the database... :S
Reply
#5

Quote:
Originally Posted by thimo
Посмотреть сообщение
Well it doesnt set the admin level in the database... :S
Check your mysql table, if the column name is like Admin and not admin.
Or check your mysql log and see if any errors came up.
Reply
#6

i dont know whats wrong when i use the query in the database then it does work..
Reply
#7

Help?
Reply
#8

Your code doesn't even make sense. You should actually try to understand how MySQL works before attempting to use it!

https://sampforum.blast.hk/showthread.php?tid=133316
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)