Setlevel Bug - 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: Setlevel Bug (
/showthread.php?tid=337703)
Setlevel Bug -
SanAndreasVille - 27.04.2012
Hello i have a Bug with my Setlevel Command
Код:
CMD:setlevel(playerid, params[])
{
new Level;
levelerror(5);
if(sscanf(params, "ud", plid, Level)) return SendErrorMessage(playerid, "Usage: /setlevel <id> <level>");
if (Level < 0 || Level > 5) return SendErrorMessage(playerid, "Admin levels are between 1 - 5");
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `adminlvl` = %d WHERE `user` = '%s'", Level, escpname(plid));
mysql_query(Query);
mysql_free_result();
format(string, sizeof(string), "You have set {FF00AA}%s(%d){FFFFFF} admin level to %d", PlayerName(plid), plid, Level);
SendClientMessage(playerid, 0xFFFFFF, string);
if(GetPVarInt(plid, "AdminLevel") < Level) format(string, sizeof(string), "You have been {CC00FF}promoted{FFFFFF} to level %d admin by admin %s(%d)", Level, PlayerName(playerid), playerid);
if(GetPVarInt(plid, "AdminLevel") > Level) format(string, sizeof(string), "You have been {FF00AA}demoted{FFFFFF} to level %d admin by admin %s(%d)", Level, PlayerName(playerid), playerid);
SendClientMessage(plid, 0xFFFFFF, string);
SetPVarInt(plid, "AdminLevel", Level);
return 1;
}
when 5-10 players on the server played, and i make /setlevel 3 5 ,then become id 5 level 5 but i have type id 3 where is the Bug in this script?
Re: Setlevel Bug -
tiernantheman - 27.04.2012
Update your sscanf or just try type /setlevel 5 3
AW: Setlevel Bug -
SanAndreasVille - 27.04.2012
is version 2.0 from where comes the id Bug?
Re: Setlevel Bug -
ViniBorn - 27.04.2012
You didn't declare 'plid'
pawn Код:
CMD:setlevel(playerid, params[])
{
new Level;
levelerror(5);
if(sscanf(params, "ud", plid, Level)) return SendErrorMessage(playerid, "Usage: /setlevel <id> <level>");
pawn Код:
CMD:setlevel(playerid, params[])
{
new Level,plid;
levelerror(5);
if(sscanf(params, "ud", plid, Level)) return SendErrorMessage(playerid, "Usage: /setlevel <id> <level>");