25.10.2018, 22:50
I found a bug :O. Stats are not saved.
Here is the code for SavePlayer func.
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
new query[1000];
new
string[800]
;
format(string, sizeof(string), "%s Cash=%d,", string, pdata[playerid][Cash]);
format(string, sizeof(string), "%s Kills=%d,", string, pdata[playerid][Kills]);
format(string, sizeof(string), "%s Deaths=%d,", string, pdata[playerid][Deaths]);
format(string, sizeof(string), "%s Level=%d,", string, pdata[playerid][Level]);
format(string, sizeof(string), "%s Score=%d,", string, pdata[playerid][Score]);
format(string, sizeof(string), "%s XP=%d,", string, pdata[playerid][XP]);
format(string, sizeof(string), "%s Coins=%d,", string, pdata[playerid][Coins]);
mysql_format(Database, query, sizeof(query), "UPDATE `users` SET %s WHERE `Username` = '%s'", string, GetName(playerid));
mysql_tquery(Database, query); //We will execute the query.
return 1;
}
here is a screenshot for table structure: http://prntscr.com/laj7md
- thanks for helping
Here is the code for SavePlayer func.
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
new query[1000];
new
string[800]
;
format(string, sizeof(string), "%s Cash=%d,", string, pdata[playerid][Cash]);
format(string, sizeof(string), "%s Kills=%d,", string, pdata[playerid][Kills]);
format(string, sizeof(string), "%s Deaths=%d,", string, pdata[playerid][Deaths]);
format(string, sizeof(string), "%s Level=%d,", string, pdata[playerid][Level]);
format(string, sizeof(string), "%s Score=%d,", string, pdata[playerid][Score]);
format(string, sizeof(string), "%s XP=%d,", string, pdata[playerid][XP]);
format(string, sizeof(string), "%s Coins=%d,", string, pdata[playerid][Coins]);
mysql_format(Database, query, sizeof(query), "UPDATE `users` SET %s WHERE `Username` = '%s'", string, GetName(playerid));
mysql_tquery(Database, query); //We will execute the query.
return 1;
}
here is a screenshot for table structure: http://prntscr.com/laj7md
- thanks for helping