09.10.2018, 17:40
Hey! I am a little confused. Just start make a backpack-system with MySQL R41 and I have issue with saving. When I create a backpack with INSERT INTO `backpacks` command, everything is alright. But when I try to move another position and save it with UPDATE `backpacks`, the object moved and debug says changed value but the value isn't change in the table. Sorry for my bad english..
Код:
[19:05:48] [DEBUG] mysql_format(1, 0x0076E3C0, 256, "UPDATE `backpacks` SET `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosRX` = %f, `PosRY` = %f, `PosRZ` = %f WHERE `ID` = %i") [19:05:48] [DEBUG] mysql_format: return value: '159' [19:05:48] [DEBUG] mysql_tquery(1, "UPDATE `backpacks` SET `PosX` = -73.955910, `PosY` = 1081.626831, `PosZ` = 19.742188, `PosRX` = 0.000000, `PosRY` = 0.000000, `PosRZ` = 0.000000 WHERE `ID` = 0", "", "") [19:05:48] [DEBUG] CCallback::Create(amx=0x291f930, name='', format='', params=0x76e3ac, param_offset=5) [19:05:48] [DEBUG] CHandle::Execute(this=0x68cb348, type=1, query=0x690bd10) [19:05:48] [DEBUG] CHandle::Execute - return value: true [19:05:48] [DEBUG] mysql_tquery: return value: '1'
Код:
SaveBackpack(id) { if(!bInfo[id][ID]) return 0; new query[256]; mysql_format(Database, query, sizeof query, "UPDATE `backpacks` SET `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosRX` = %f, `PosRY` = %f, `PosRZ` = %f WHERE `ID` = %i", bInfo[id][Pos][0], bInfo[id][Pos][1], bInfo[id][Pos][2], bInfo[id][Pos][3], bInfo[id][Pos][4], bInfo[id][Pos][5], bInfo[id][VirtualWorld], bInfo[id][Interior], bInfo[id][Type], bInfo[id][Use], bInfo[id][ID]); mysql_tquery(Database, query); for(new i = 0; i < 20; i++) { mysql_format(Database, query, sizeof query, "UPDATE `backpacks` SET `Item%d` = %d WHERE `ID` = %i", i, bInfo[id][Item][i], bInfo[id][ID]); mysql_tquery(Database, query); mysql_format(Database, query, sizeof query, "UPDATE `backpacks` SET `ItemAmount%d` = %d WHERE `ID` = %i", i, bInfo[id][ItemAmount][i], bInfo[id][ID]); mysql_tquery(Database, query); } printf("[Mentйs] Hбtizsбk elmentve. ID: %d.", id); return 1; }