new query[512], Float:xpos, Float:ypos, Float:zpos; GetPlayerPos(playerid, xpos, ypos, zpos); mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Frakcio`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,`Uj`=%d,`Munka`=%d,`Skin`=%d,`FSkin`=%d WHERE `ID`=%d",\ pInfo[playerid][Admin], pInfo[playerid][Frakcio], pInfo[playerid][Money], xpos, ypos, zpos, pInfo[playerid][Uj], pInfo[playerid][Munka], pInfo[playerid][Skin], pInfo[playerid][FSkin], pInfo[playerid][ID]); mysql_tquery(mysql, query, "", "");
SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posZ], pInfo[playerid][posZ]+ 0.3);
forward OnAccountRegister(playerid); public OnAccountLoad(playerid) { pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); pInfo[playerid][Frakcio] = cache_get_field_content_int(0, "Frakcio"); pInfo[playerid][Money] = cache_get_field_content_int(0, "Money"); pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX"); pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY"); pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ"); pInfo[playerid][Uj] = cache_get_field_content_int(0, "Uj"); pInfo[playerid][Munka] = cache_get_field_content_int(0, "Munka"); pInfo[playerid][Skin] = cache_get_field_content_int(0, "Skin"); pInfo[playerid][FSkin] = cache_get_field_content_int(0, "FSkin"); SendClientMessage(playerid, -1, "Successfully logged in"); return 1; }
[14:56:10] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "samp", password: "****", port: 3306, autoreconnect: true, pool_size: 2 [14:56:10] [DEBUG] CMySQLHandle::Create - creating new connection.. [14:56:10] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called [14:56:10] [DEBUG] CMySQLHandle::Create - connection created (id: 1) [14:56:10] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:56:10] [DEBUG] CMySQLConnection::Connect - connection was successful [14:56:10] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:56:10] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:56:10] [DEBUG] mysql_errno - connection: 1 [14:56:10] [DEBUG] CMySQLConnection::Connect - connection was successful [14:56:10] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:56:10] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:56:10] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:56:10] [DEBUG] CMySQLConnection::Connect - connection was successful [14:56:10] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:56:10] [DEBUG] CMySQLConnection::Connect - connection was successful [14:56:10] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:56:49] [DEBUG] mysql_format - connection: 1, len: 512, format: "SELECT `Password`, `ID` FROM `players` WHERE `Username` = '%e' LIMIT 1" [14:56:49] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `players` WHERE `Username` = 'Tom_C", callback: "OnAccountCheck", format: "i" [14:56:49] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution [14:56:49] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 4.914 milliseconds [14:56:49] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [14:56:49] [DEBUG] Calling callback "OnAccountCheck".. [14:56:50] [DEBUG] cache_get_data - connection: 1 [14:56:50] [DEBUG] cache_get_field_content - row: 0, field_name: "Password", connection: 1, max_len: 129 [14:56:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Password", data: "A6AFF08FDDD86792EA54AE3099C10A2107A0B75B35220608020BFDDFB72CA16C1CE19ECF22C3255741FAC1E5564EDAF1968455EF1BADFE8443B6174190B93287" [14:56:50] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1 [14:56:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "1" [14:56:50] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [14:57:00] [DEBUG] mysql_format - connection: 1, len: 512, format: "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1" [14:57:00] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `players` WHERE `Username` = 'Tom_Curt' LIMIT 1", callback: "OnAccountLoad", format: "i" [14:57:00] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - starting query execution [14:57:00] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - query was successfully executed within 0.688 milliseconds [14:57:00] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [14:57:00] [DEBUG] Calling callback "OnAccountLoad".. [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Admin", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Admin", data: "3" [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Frakcio", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Frakcio", data: "0" [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Money", data: "123" [14:57:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosX", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosX", data: "-50.3895" [14:57:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosY", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosY", data: "3.24298" [14:57:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosZ", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosZ", data: "3.11719" [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Uj", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Uj", data: "1" [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Munka", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Munka", data: "1" [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Skin", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Skin", data: "23" [14:57:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "FSkin", connection: 1 [14:57:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "FSkin", data: "288" [14:57:00] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [14:57:07] [DEBUG] mysql_format - connection: 1, len: 512, format: "UPDATE `players` SET `Admin`=%d, `Frakcio`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,`Uj`=%d,`Munka`=%d,`Skin`=%d,`FSkin`=..." [14:57:07] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `players` SET `Admin`=3, `Frakcio`=0, `Money`=123, `posX`", callback: "(null)", format: "(null)" [14:57:07] [DEBUG] CMySQLQuery::Execute[] - starting query execution [14:57:07] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 142.30 milliseconds [14:57:07] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
GetPlayerPos: This function is known to return unreliable values when used in OnPlayerDisconnect and OnPlayerRequestClass. This is because the player is not spawned. - From SA:MP Wiki
format(query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Frakcio`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,`Uj`=%d,`Munka`=%d,`Skin`=%d,`FSkin`=%d WHERE `ID`=%d",\
pInfo[playerid][Admin], pInfo[playerid][Frakcio], pInfo[playerid][Money], xpos, ypos, zpos, pInfo[playerid][Uj], pInfo[playerid][Munka], pInfo[playerid][Skin], pInfo[playerid][FSkin], pInfo[playerid][ID]);
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Frakcio`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,`Uj`=%d,`Munka`=%d,`Skin`=%d,`FSkin`=%d WHERE `ID`=%d",\
pInfo[playerid][Admin], pInfo[playerid][Frakcio], pInfo[playerid][Money], xpos, ypos, zpos, pInfo[playerid][Uj], pInfo[playerid][Munka], pInfo[playerid][Skin], pInfo[playerid][FSkin], pInfo[playerid][ID]);
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Frakcio`=%d, `Money`=%d, `PosX`=%f, `PosY`=%f, `PosZ`=%f,`Uj`=%d,`Munka`=%d,`Skin`=%d,`FSkin`=%d WHERE `ID`=%d",\
pInfo[playerid][Admin], pInfo[playerid][Frakcio], pInfo[playerid][Money], xpos, ypos, zpos, pInfo[playerid][Uj], pInfo[playerid][Munka], pInfo[playerid][Skin], pInfo[playerid][FSkin], pInfo[playerid][ID]);
Read the notes on the wiki page of either GetPlayerPos or OnPlayerDisconnect.
|