01.01.2012, 07:25
(
Последний раз редактировалось spedico; 01.01.2012 в 08:15.
)
I am fairly new with MySQL, I need some help.
Problem is, it won't save or load the info.
pawn Код:
enum bStats
{
Username[24],
Password[35],
Kills,
Deaths,
Money,
Admin,
Float:LastX,
Float:LastY,
Float:LastZ,
Interior,
Score,
Respect,
ArmorUpgrade
}
new bInfo[MAX_PLAYERS][bStats];
pawn Код:
stock SaveStats(playerid) // And this.
{
if(GetPVarInt(playerid, "IsLogged") == 1)
{
new Query[600];
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d, `Score` = %d, `Respect` = %d, `ArmorUpgrade` = %d WHERE `user` = '%s'",
bInfo[playerid][Kills],
bInfo[playerid][Deaths],
GetPlayerMoney(playerid),
bInfo[playerid][Admin],
bInfo[playerid][LastX],
bInfo[playerid][LastY],
bInfo[playerid][LastZ],
GetPlayerInterior(playerid),
GetPlayerScore(playerid),
bInfo[playerid][Respect],
bInfo[playerid][ArmorUpgrade],
GetName(playerid));
mysql_query(Query);
mysql_free_result();
return 1;
}
else return 0;
}
pawn Код:
stock LoadPlayerInfo(playerid)
{
new Query[700];
if(mysql_fetch_row(Query))
{
sscanf(Query, "e<p<|>s[24]s[35]ddddfffdddd>", bInfo[playerid]);
mysql_free_result();
}
return 1;
}