Sscanf Error! - 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: Sscanf Error! (
/showthread.php?tid=499879)
Sscanf Error! -
Tass007 - 10.03.2014
I downloaded a script and when i hooked up my mysql and everything to it i went into the server and all i got was a black screen...
I turned on the nativechecker plugin and i got a error message in the server.log saying
Код:
sscanf warning: String buffer overflow.
So i did some searching and found that my OnPlayerconnect is mostly what is casing this
pawn Код:
public OnPlayerConnect(playerid)
{
new Query[256], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof pName);
mysql_real_escape_string(pName, pName);
format(Query, sizeof Query, "SELECT * FROM `accounts` WHERE `Name` = '%s' LIMIT 1", pName);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
new IP[16];
GetPlayerIp(playerid, IP, sizeof IP);
format(Query, sizeof Query, "SELECT * FROM `accounts` WHERE `Name` = '%s' and IP = '%s' LIMIT 1", pName, IP);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
mysql_fetch_row(Query);
new values[5];
sscanf(Query, "p<|>{s[24]s[129]s[16]}a<i>[5]", values);
SetPVarInt(playerid, "Admin", values[0]);
GivePlayerMoney(playerid, values[1]);
SetPlayerScore(playerid, values[2]);
SetPVarInt(playerid, "Kills", values[3]);
SetPVarInt(playerid, "Deaths", values[4]);
SetPVarInt(playerid, "Logged", 1);
SendClientMessage(playerid, COLOR_LIMEGREEN, "[*] Welcome back! You've been automatically logged in.");
}
else SendClientMessage(playerid, COLOR_ORANGE, "[*] Your account has been found, please use \"/login\" to log in!");
}
Or maybe even just the line
pawn Код:
sscanf(Query, "p<|>{s[24]s[129]s[16]}a<i>[5]", values);
Please could someone help me? Would be much appreciated.
Re: Sscanf Error! -
Macronix - 10.03.2014
Mh, try to increase the size of the Query variable
Re: Sscanf Error! -
Tass007 - 10.03.2014
I increased the Query to 400 but i don't get the error but when i go ingame i still get the black screen?
pawn Код:
new Query[400], pName[MAX_PLAYER_NAME];
Thanks for helping.
Re: Sscanf Error! -
Tass007 - 11.03.2014
BUMP!
Re: Sscanf Error! -
yvoms - 11.03.2014
So now it only gives you a black screen did you try checking ur server log again?
Re: Sscanf Error! -
Tass007 - 11.03.2014
Yeh i got nothing.
Re: Sscanf Error! -
SkilledMaster - 11.03.2014
Try Re-Downloading the SScanf Files, and Re-Compiling the Script. Had the same problem.