Mysql loadstats - 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 loadstats (
/showthread.php?tid=415495)
[Mysql + sscanf] Doesn't load info -
dusk - 13.02.2013
pawn Код:
stock LoadStats(playerid)
{
new resultquery[256];
format(resultquery,sizeof(resultquery),"SELECT * FROM users WHERE username = '%s'",Name);
mysql_query(resultquery);
mysql_store_result();
mysql_fetch_row_format(resultquery,"|");
sscanf(resultquery,"p<|>dddds",PlayerInfo[playerid][alevel],PlayerInfo[playerid][level],PlayerInfo[playerid][money],PlayerInfo[playerid][Mechanic],PlayerInfo[playerid][items]);
GivePlayerMoney(playerid,PlayerInfo[playerid][money]);
SetPlayerScore(playerid,PlayerInfo[playerid][level]);
mysql_free_result();
return 1;
}
So the thing is,it just doesn't load anything.No compiling errors. I'm pretty sure that the problem is the split part with sscanf.
Could anyone tell me how to use it? Or is the problem elsewhere?
I'm just learning mysql.
Re: Mysql loadstats -
MattSlater - 13.02.2013
What MYSQL version are you using?
Re: Mysql loadstats - Riddy - 13.02.2013
Quote:
Originally Posted by MattSlater
What MYSQL version are you using?
|
My guess is either R5 or R6
Re: Mysql loadstats -
dusk - 14.02.2013
It's R6
Re: Mysql loadstats -
dusk - 14.02.2013
bump,so any answers after getting that information?
Re: Mysql loadstats -
dusk - 15.02.2013
anyone? i really need the answer
Re: Mysql loadstats -
dusk - 15.02.2013
I tried fixing it myself,and this is what i have so far:
pawn Код:
public OnPlayerSpawn(playerid)
{
new moneyquery[256];
format(moneyquery,sizeof(moneyquery),"SELECT * FROM `users` WHERE `username` = '%s'",Name);
mysql_query(moneyquery);
mysql_store_result();
mysql_fetch_row_format(moneyquery,"|");
sscanf(moneyquery,"p<|>dssdsdddd",PlayerInfo[playerid][userid],PlayerInfo[playerid][username],PlayerInfo[playerid][pPass],PlayerInfo[playerid][alevel],PlayerInfo[playerid][items],PlayerInfo[playerid][money],PlayerInfo[playerid][level],PlayerInfo[playerid][Mechanic],PlayerInfo[playerid][SkinID]);
SetPlayerSkin(playerid,PlayerInfo[playerid][SkinID]);
GivePlayerMoney(playerid, PlayerInfo[playerid][money]);
mysql_free_result();
return 1;
}
Could anyone help?
sorry for the posts,i just really need this
Re: Mysql loadstats -
dusk - 15.02.2013
bump
Re: Mysql loadstats -
dusk - 15.02.2013
bump
Re: Mysql loadstats -
dusk - 16.02.2013
bump.Please help,i cant do anything further without this