mysql & sscanf - 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: mysql & sscanf (
/showthread.php?tid=523186)
mysql & sscanf -
Onfroi - 01.07.2014
Can anyone tell me what I'm doing wrong here:
pawn Код:
stock LoadStats(playerid)
{
format(Query, sizeof(Query), "SELECT * FROM `jugadores` WHERE nickname = '%s'", pName(playerid));
mysql_query(Query);
mysql_store_result();
mysql_fetch_row_format(Query, "|");
sscanf(Query, "p<|>s[24]s[128]s[16]ddddd", pInfo[playerid][nickname],pInfo[playerid][pass],pInfo[playerid][IP],
pInfo[playerid][score],pInfo[playerid][kills],pInfo[playerid][deaths],pInfo[playerid][money],pInfo[playerid][AdminLvl]);
printf("Money: %d", pInfo[playerid][money]);
mysql_free_result();
return 1;
}
I have no idea why sscanf won't save the values to those variables, on the debug I get this:
Код:
0:15:04] CMySQLHandler::Query(SELECT * FROM `jugadores` WHERE nickname = 'Onfroi') - Successfully executed.
[20:15:04] >> mysql_store_result( Connection handle: 1 )
[20:15:04] CMySQLHandler::StoreResult() - Result was stored.
[20:15:04] >> mysql_fetch_row_format( Connection handle: 1 )
[20:15:04] CMySQLHandler::FetchRow() - Return: 4|Onfroi|a94a8fe5ccb19ba61c4c0873d391e987982fbbd3|127.0.0.1|0|0|0|1000|0
[20:15:04] >> mysql_free_result( Connection handle: 1 )
[20:15:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[20:15:04] >> mysql_free_result( Connection handle: 1 )
[20:15:04] CMySQLHandler::FreeResult() - The result is already empty.
[20:15:10] >> mysql_query( Connection handle: 1 )
[20:15:10] CMySQLHandler::Query(UPDATE `jugadores` SET `score`='0', `kills`='0', `deaths`='0', `money`='0', `AdminLvl`='0' WHERE (`nickname` = 'Onfroi')) - Successfully executed.
The only thing I get is a warning in the console saying
'string buffer overflow
', but I don't think that's the problem
Re: mysql & sscanf -
Onfroi - 01.07.2014
Any help

I got stuck with this