Sscanf Error!
#1

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.
Reply
#2

Mh, try to increase the size of the Query variable
Reply
#3

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.
Reply
#4

BUMP!
Reply
#5

So now it only gives you a black screen did you try checking ur server log again?
Reply
#6

Yeh i got nothing.
Reply
#7

Try Re-Downloading the SScanf Files, and Re-Compiling the Script. Had the same problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)