TEUSMA Posted September 9, 2020 Share Posted September 9, 2020 Hello guys, wanted to fix a bug! ERROR: inventario\client.lua932: attempt to index field '?' (a nil value) the item not disappear after i consumed it Link to comment
CortezAR Posted September 9, 2020 Share Posted September 9, 2020 Hi, try send photos of line 932 > inventario >> client.lua. Link to comment
TEUSMA Posted September 9, 2020 Author Share Posted September 9, 2020 (edited) function delItem(itemSlot) if (itemSlot > -1) then if activeSide == "craft" then newMenu = "bag" else newMenu = activeSide end ==LINE:932== triggerServerEvent("deleteItem", localPlayer, localPlayer, localPlayer, elementSource, inventoryItems[newMenu][itemSlot]["ID"]) saveAction() inventoryItems[newMenu][itemSlot] = nil if (elementSource == localPlayer) then playerItems[newMenu][itemSlot] = nil end end end Edited September 9, 2020 by TEUSMA Link to comment
Moderators Patrick Posted September 9, 2020 Moderators Share Posted September 9, 2020 The error message (attempt to index field '?' (a nil value)) refers to the table. Probably inventoryItems[newMenu][itemSlot] is not exists. (so it is nil). And you can't get the "ID" of nothing. Link to comment
TEUSMA Posted September 9, 2020 Author Share Posted September 9, 2020 8 minutes ago, Patrick said: The error message (attempt to index field '?' (a nil value)) refers to the table. Probably inventoryItems[newMenu][itemSlot] is not exists. (so it is nil). And you can't get the "ID" of nothing. what do I do then? Link to comment
Moderators Patrick Posted September 9, 2020 Moderators Share Posted September 9, 2020 (edited) 12 minutes ago, TEUSMA said: what do I do then? Make sure about inventoryItems[newMenu][itemSlot] is exists (with a simple IF-statement), and don't execute this part of code if it's not exists: triggerServerEvent("deleteItem", localPlayer, localPlayer, localPlayer, elementSource, inventoryItems[newMenu][itemSlot]["ID"]) saveAction() inventoryItems[newMenu][itemSlot] = nil if (elementSource == localPlayer) then playerItems[newMenu][itemSlot] = nil end Edited September 9, 2020 by Patrick Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now