12.11.2013, 17:07
(
Последний раз редактировалось ikkentim; 12.11.2013 в 19:31.
)
Hi, My server keeps crashing when taking an item(during the execution of orm_delete) when I run this code:
Debug output:
Is it a bug, a known bug or just an error on my side? can anyone help me with this?
EDIT: After 2 hours of hard work i found that i didnt bind the key (id) to a var...
Код:
//Loading of items public OnPlayerInventoryLoaded(playerid) { for(new r=0; r < cache_num_rows() && r < MAX_PLAYER_INVENTORY; ++r) { new ORM:ormid = PlayerInventory[playerid][r][ItemORM] = orm_create("playerinventory", GetSQLHandle()); orm_addvar_int(ormid, _:PlayerInventory[playerid][r][ItemType], "type"); orm_addvar_int(ormid, PlayerInventory[playerid][r][ItemQuantity], "quantity"); orm_addvar_int(ormid, PlayerInventory[playerid][r][ItemData], "data"); orm_setkey(ormid, "id"); //Set id as the key orm_apply_cache(ormid, r);//Apply cache } return 1; } //Taking an item(crashes) stock TakePlayerItem(playerid, item[EItem], count=1) { new itemslot = GetPlayerItemOfItem(playerid, item); printf("itemslot: %d", itemslot); //Check quantity if(itemslot == INVALID_ITEM || PlayerInventory[playerid][itemslot][ItemQuantity] < count) return 0; PlayerInventory[playerid][itemslot][ItemQuantity]-= count; printf("Items Left: %d", PlayerInventory[playerid][itemslot][ItemQuantity]); if(PlayerInventory[playerid][itemslot][ItemQuantity] == 0) { printf("ORM handle: %d", _:PlayerInventory[playerid][itemslot][ItemORM]); orm_delete(PlayerInventory[playerid][itemslot][ItemORM], false);//Here it crashes orm_destroy(PlayerInventory[playerid][itemslot][ItemORM]); } return 1; }
Код:
[19:01:56] itemslot: 0 [19:01:56] Items Left: 0 [19:01:56] ORM handle: 5 [19:01:56] [debug] Server crashed while executing lsres.amx [19:01:56] [debug] AMX backtrace: [19:01:56] [debug] #0 native orm_delete () [6f08b6f0] from mysql.DLL [19:01:56] [debug] #1 000090c8 in TakePlayerItem (playerid=0, item[EItem:4]=@0x0011a2d8, count=1) at ../lsres/inventory/player.inc:114 [19:01:56] [debug] #2 00008b3c in public OnPlayerInventoryClicked (playerid=0, item[EItem:4]=@0x0011a2d8, EInventoryAction:action=0) at ../lsres/inventory/player.inc:85 [19:01:56] [debug] #3 native CallLocalFunction () [00471ef0] from samp-server.exe [19:01:56] [debug] #4 00007efc in invitem_ClickTD (playerid=0, PlayerText:playertextid=5) at ../lsres/inventory/inventorydisplay.inc:274 [19:01:56] [debug] #5 0000b2c8 in public OnPlayerClickPlayerTextDraw (playerid=0, PlayerText:playertextid=5) at E:/projects/lsres2/gamemodes/lsres.pwn:273 [19:01:56] [debug] Native backtrace: [19:01:56] [debug] #0 6f082fd6 in ?? () from E:\projects\lsres2\plugins\mysql.DLL [19:01:56] [debug] #1 6f07f2b6 in ?? () from E:\projects\lsres2\plugins\mysql.DLL [19:01:56] [debug] #2 6f08b7fa in ?? () from E:\projects\lsres2\plugins\mysql.DLL [19:01:56] [debug] #3 004010b6 in ?? () from E:\projects\lsres2\samp-server.exe [19:01:56] [debug] #4 6eb65f2a in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #5 6eb6822e in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #6 6eb5ff6f in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #7 6eb65f7a in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #8 004721fe in ?? () from E:\projects\lsres2\samp-server.exe [19:01:56] [debug] #9 004010b6 in ?? () from E:\projects\lsres2\samp-server.exe [19:01:56] [debug] #10 6eb65f2a in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #11 6eb6822e in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #12 6eb5ff6f in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #13 6eb65f7a in ?? () from E:\projects\lsres2\plugins\crashdetect.DLL [19:01:56] [debug] #14 0046e0db in ?? () from E:\projects\lsres2\samp-server.exe
EDIT: After 2 hours of hard work i found that i didnt bind the key (id) to a var...