19.07.2017, 11:09
(
Последний раз редактировалось GoldenLion; 19.07.2017 в 12:18.
)
Hi, I'm making an inventory system, but when it's supposed to load the inventory the server crashes at the mysql_pquery part where it selects the items from the database.
Here's the code:
I've been trying to figure out this for an hour now, but I can't find any mistakes, because the query works, I tried it in phpmyadmin, I have the "OnInventoryLoaded" callback and I have the table.
This is what crashdetect prints:
What's wrong here?
EDIT: By the way the query works anywhere except OnCharacterLoaded.
Here's the code:
Код:
forward OnCharacterLoaded(playerid); public OnCharacterLoaded(playerid) { new rows; cache_get_row_count(rows); if (!rows) { PlayerInfo[playerid][pCharacterID] = 0; ShowCharacters(playerid); } else { new name[MAX_PLAYER_NAME], query[80]; cache_get_value_name(0, "Name", name, sizeof(name)); cache_get_value_name_int(0, "Gender", PlayerInfo[playerid][pGender]); cache_get_value_name(0, "Birthdate", PlayerInfo[playerid][pBirthdate], 11); cache_get_value_name_int(0, "Skin", PlayerInfo[playerid][pSkin]); cache_get_value_name_float(0, "PosX", PlayerInfo[playerid][pPos][0]); cache_get_value_name_float(0, "PosY", PlayerInfo[playerid][pPos][1]); cache_get_value_name_float(0, "PosZ", PlayerInfo[playerid][pPos][2]); cache_get_value_name_float(0, "PosA", PlayerInfo[playerid][pPos][3]); SetPlayerName(playerid, name); mysql_format(database, query, sizeof(query), "SELECT * FROM inventories WHERE CharacterID = %d LIMIT %d", PlayerInfo[playerid][pCharacterID], MAX_INVENTORY); mysql_pquery(database, query, "OnInventoryLoaded", "d", playerid); } for (new i = 6; i <= 13; i++) PlayerTextDrawHide(playerid, PlayerInfo[playerid][pTextdraw][i]); TextDrawHideForPlayer(playerid, g_Textdraw[4]); }
This is what crashdetect prints:
Код:
[13:50:55] [debug] Server crashed while executing nrp.amx [13:50:55] [debug] AMX backtrace: [13:50:55] [debug] #0 native mysql_pquery () from mysql.DLL [13:50:55] [debug] #1 00021348 in public OnCharacterLoaded (playerid=0) at C:\Users\dell\Desktop\Nevada Roleplay\gamemodes\nrp.pwn:1267 [13:50:55] [debug] Native backtrace: [13:50:55] [debug] #0 5d278120 in ?? () from plugins\mysql.DLL [13:50:55] [debug] #1 5d297e69 in ?? () from plugins\mysql.DLL [13:50:55] [debug] #2 5d29f0a1 in ?? () from plugins\mysql.DLL [13:50:55] [debug] #3 004010b6 in ?? () from samp-server.exe [13:50:55] [debug] #4 5da3c6fa in ?? () from plugins\crashdetect.DLL [13:50:55] [debug] #5 5da42278 in ?? () from plugins\crashdetect.DLL [13:50:55] [debug] #6 5da3a0d7 in ?? () from plugins\crashdetect.DLL [13:50:55] [debug] #7 5da3c74a in ?? () from plugins\crashdetect.DLL [13:50:55] [debug] #8 5d524629 in ?? () from plugins\streamer.DLL [13:50:55] [debug] #9 5d2789c0 in ?? () from plugins\mysql.DLL [13:50:55] [debug] #10 5d29677d in ?? () from plugins\mysql.DLL [13:50:55] [debug] #11 5d29910c in ?? () from plugins\mysql.DLL [13:50:55] [debug] #12 5d27cfb1 in ?? () from plugins\mysql.DLL [13:50:55] [debug] #13 5d27d1e3 in ?? () from plugins\mysql.DLL [13:50:55] [debug] #14 5d27eaae in ?? () from plugins\mysql.DLL [13:50:55] [debug] #15 00469a66 in ?? () from samp-server.exe [13:50:55] [debug] #16 0048d4db in ?? () from samp-server.exe [13:50:55] [debug] #17 0049b4a1 in ?? () from samp-server.exe [13:50:55] [debug] #18 0049b4b1 in ?? () from samp-server.exe
EDIT: By the way the query works anywhere except OnCharacterLoaded.