MYSQL Problem...!
#1

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[340], Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,\
    `Score` =%d, `Banned` =%d, `Cuffed` =%d, `Muted` =%d, `Jailed` =%d, `JailTime` =%d, `Drugs` =%d, `DrugAmount` =%d, `Robskill` =%d, `Hitmanskill` =%d, `Terskill` =%d, `TotalRobs` =%d,\
    `Skin` =%d, `Team` =%d, `Kills` =%d, `Deaths`=%d WHERE `ID`=%d"
,
    pinfo[playerid][Admin], pinfo[playerid][VIP],pinfo[playerid][Money], pos[0], pos[1], pos[2],
    pinfo[playerid][Score],pinfo[playerid][Banned], pinfo[playerid][Cuffed],pinfo[playerid][Muted],
    pinfo[playerid][Jailed],pinfo[playerid][JailTime],pinfo[playerid][Drug],pinfo[playerid][DrugAmount],
    pinfo[playerid][Robskill],pinfo[playerid][Hitmanskill],pinfo[playerid][Terskill],pinfo[playerid][Skin],
    pinfo[playerid][Team],pinfo[playerid][Kills],pinfo[playerid][Deaths],pinfo[playerid][ID]);
   
    mysql_tquery(mysql, query, "", "");

    return 1;
}
it doesnt updates player's stats
debug says that :
Код:
[01:46:45] [DEBUG] mysql_format - connection: 1, len: 340, format: "UPDATE `players` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,`Score` =%d, `Banned` =%d, `Cuffed` =%d, ..."
[01:46:45] [ERROR] mysql_format - no value for specifier "%d" available
[01:46:45] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `players` SET `Admin`=0, `VIP`=0, `Money`=0, `posX`=-9.56", callback: "(null)", format: "(null)"
[01:46:45] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[01:46:45] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
[01:46:45] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
Reply
#2

You're missing TotalRobs variable after pinfo[playerid][Terskill].
Reply
#3

I am going to say this again and again until someone actually accepts my advice. You do not need to save everything at once. How often does the admin level change? How often does the VIP level change? How often does the player die (assuming RP), how often does the player kill someone? Why bother updating something that probably hasn't changed? In the rare event it does change, update immediately.

Small queries are your friend (and in the event of large joined select queries it's probably better to create a view).
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
I am going to say this again and again until someone actually accepts my advice. You do not need to save everything at once. How often does the admin level change? How often does the VIP level change? How often does the player die (assuming RP), how often does the player kill someone? Why bother updating something that probably hasn't changed? In the rare event it does change, update immediately.

Small queries are your friend (and in the event of large joined select queries it's probably better to create a view).
No vince i am using your way i just wanted to test something nothing more i am using your way for saving systems.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)