03.11.2014, 15:49
(
Последний раз редактировалось Capua; 03.11.2014 в 17:58.
)
I can't get my setlevel cmd working. I get the level in game, but it doesn't update in mysql so the level will be back to 0 upon relogging.
Here's the code;
![](http://i.imgur.com/G054klA.png)
As you can see, it's not updating. As alevel type in mysql I'm using int(11).
Also, you may have noticed that %s isn't working properly. It doesn't show the name at all.
Need help with these two things thanks!
Here's the code;
pawn Код:
CMD:setlevel( playerid, params[] )
{
//if (gPlayerInfo[playerid][pAlevel]<4)
//return SendClientMessage(playerid,-1,"You need to be level 4 to use this.");
new id,level;
if (sscanf(params,"ud",id,level))
return SendClientMessage(playerid,-1,"USAGE: /setlevel [ID] [Level].");
if (!IsPlayerConnected(id) || id==INVALID_PLAYER_ID)
return SendClientMessage(playerid,-1,"Invalid ID!");
if (level>SERVER_MAX_LEVEL || level<SERVER_MIN_LEVEL)
return SendClientMessage(playerid,-1,"Level must be between 0 and 4!");
gPlayerInfo[playerid][pAlevel]=level;
new query[300];
format(query, sizeof(query), "UPDATE `users` SET ґalevelґ=ґ%dґ WHERE `id` = %i", level, gPlayerInfo[playerid][pID]);
mysql_function_query(gHandle, query, false, "query", "", "");
new string[70];
String("Adminstrator %s has set your admin level to %d!",gPlayerInfo[playerid][pName],level);
SendClientMessage(id,-1,string);
String("You have set %s's level to %d! ",gPlayerInfo[id][pName],level);
SendClientMessage(id,-1,string);
return 1;
}
Quote:
[18:37:45] Adminstrator has set your admin level to 4! [18:37:45] You have set 's level to 4! [18:37:46] Current admins online: [18:37:46] | Level: 4 | ID: 0 |
![](http://i.imgur.com/G054klA.png)
As you can see, it's not updating. As alevel type in mysql I'm using int(11).
Also, you may have noticed that %s isn't working properly. It doesn't show the name at all.
Need help with these two things thanks!