public OnPlayerDisconnect(playerid, reason) { new query[128], Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); mysql_format(mysql,query,sizeof(query), "UPDATE players SET Money='%d', Admin='%d', Skin='%d', Health='%f', PosX='%f', PosY='%f', PosZ='%f' WHERE ID='%d'", pMoney[playerid], pAdmin[playerid], pSkin[playerid], pHealth[playerid], pos[0], pos[1], pos[2], pID[playerid]); mysql_tquery(mysql,query,"",""); return 1; }
Firstly don't use (' )when you demand from system to get an integer. Because MySQL reads it as a string and must convert it and it will take time(Not something great but some small things it could help you a bit in the future.).
Secondly there is no error here? Have you created the column for health at database? |
[18:46:22] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "gangsofls", password: "****", port: 3306, autoreconnect: true, pool_size: 2 [18:46:22] [DEBUG] CMySQLHandle::Create - creating new connection.. [18:46:22] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called [18:46:22] [DEBUG] CMySQLHandle::Create - connection created (id: 1) [18:46:22] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [18:46:22] [DEBUG] CMySQLConnection::Connect - connection was successful [18:46:22] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [18:46:22] [DEBUG] mysql_errno - connection: 1 [18:46:22] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [18:46:22] [DEBUG] CMySQLConnection::Connect - connection was successful [18:46:22] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [18:46:22] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [18:46:22] [DEBUG] CMySQLConnection::Connect - connection was successful [18:46:22] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [18:46:22] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [18:46:22] [DEBUG] CMySQLConnection::Connect - connection was successful [18:46:22] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [18:46:52] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `ID` FROM `players` WHERE `Username` = '%e' LIMIT 1" [18:46:52] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `players` WHERE `Username` = 'testa", callback: "OnAccountCheck", format: "i" [18:46:52] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution [18:46:52] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.323 milliseconds [18:46:52] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [18:46:52] [DEBUG] Calling callback "OnAccountCheck".. [18:46:52] [DEBUG] cache_get_data - connection: 1 [18:46:52] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [18:46:53] [DEBUG] mysql_format - connection: 1, len: 300, format: "INSERT INTO `players` (`Username`, `Password`, `IP`, `PosX`, `PosY`, `PosZ`) VALUES ('%e', '%s', '%s', '%f', '%f', '%f')" [18:46:53] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `players` (`Username`, `Password`, `IP`, `PosX`, `Po", callback: "OnAccountRegister", format: "i" [18:46:53] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution [18:46:53] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - query was successfully executed within 1.214 milliseconds [18:46:53] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [18:46:53] [DEBUG] Calling callback "OnAccountRegister".. [18:46:53] [DEBUG] cache_insert_id - connection: 1 [18:46:53] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [18:47:03] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE players SET Money='%d', Admin='%d', Skin='%d', Health='%f', PosX='%f', PosY='%f', PosZ='%f' WHERE ID='%d'" [18:47:03] [ERROR] mysql_format - destination size is too small [18:47:03] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE players SET Money='1000', Admin='0', Skin='8', Health='10", callback: "(null)", format: "(null)" [18:47:03] [DEBUG] CMySQLQuery::Execute[] - starting query execution [18:47:03] [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 [18:47:03] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError