Set Level not saving - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Set Level not saving (
/showthread.php?tid=307250)
Set Level not saving -
thimo - 29.12.2011
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!
Re: Set Level not saving -
thimo - 30.12.2011
BUMP help please!

whats wrong
Re: Set Level not saving -
FireCat - 30.12.2011
Wtf? Explain better...
It doesn't set the admin level on the database? Or it doesn't get the admin level before if(sscanf...?
Re: Set Level not saving -
thimo - 30.12.2011
Well it doesnt set the admin level in the database... :S
Re: Set Level not saving -
FireCat - 30.12.2011
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.
Re: Set Level not saving -
thimo - 30.12.2011
i dont know whats wrong when i use the query in the database then it does work..
Re: Set Level not saving -
thimo - 01.01.2012
Help?
Re: Set Level not saving -
Scenario - 01.01.2012
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