Zakrepe Posted February 18, 2019 Share Posted February 18, 2019 Help me i get this error: attempt to perform arithmetic on a boolean value addEventHandler("onClientGUIClick", inv.button[4], function() local value = ((getElementCurrentSlots(localPlayer)+getItemSlots(itemName)) - getElementMaxSlots(localPlayer)) local value = tonumber( value ) if value and value > 1 then local itemName = guiGridListGetItemText(inv.grid[1], guiGridListGetSelectedItem(inv.grid[1]), 1); if isPlayerInLoot() then if getElementData(isPlayerInLoot(), itemName) and getElementData(isPlayerInLoot(), itemName) >= value then if not isToolbeltItem(itemName) then if (getElementCurrentSlots(localPlayer)+getItemSlots(itemName) <= getElementMaxSlots(localPlayer)) then if not playerMovedInInventory then triggerEvent("onPlayerMoveItemInInventoryFast", localPlayer, itemName, isPlayerInLoot(),value); playerMovedInInventory = true; setTimer(function() playerMovedInInventory = false; end, 700, 1); else startRollMessage("You can't pick up items that fast!", 255, 22, 0); return; end else triggerEvent("gs_notification_text",getLocalPlayer(),"error","Inventory is full!") return; end else playerMovedInInventory = true; setTimer(function() playerMovedInInventory = false end, 700, 1); triggerEvent("onPlayerMoveItemInInventoryFast", localPlayer, itemName, isPlayerInLoot(),value); end end if isPlayerInLoot() then setTimer(refreshInventory, 200, 2); setTimer(refreshLoot, 200, 2, getElementData(localPlayer, "currentCol"), guiGetText(inv.label[1])); end end end end); Link to comment
Captain Cody Posted February 18, 2019 Share Posted February 18, 2019 Please give the entire debug message. Link to comment
Zakrepe Posted February 18, 2019 Author Share Posted February 18, 2019 I wanted to create a system that after clicking the button, it transfers the maximum amount of object that we can pick up. Link to comment
Mr.Loki Posted February 19, 2019 Share Posted February 19, 2019 1 of your functions[ getElementCurrentSlots, getItemSlots, getElementMaxSlots ] is returning false so debug them use iprint to check the values they return so you can find the culprit Link to comment
Zakrepe Posted February 19, 2019 Author Share Posted February 19, 2019 I think bug line : local value = (getElementCurrentSlots(LocalPlayer)+getItemSlots(itemName) - getElementMaxSlots(LocalPlayer)) And code now look that: addEventHandler("onClientGUIClick", inv.button[4], function() local itemName = guiGridListGetItemText(inv.grid[1], guiGridListGetSelectedItem(inv.grid[1]), 1); local value = (getElementCurrentSlots(LocalPlayer)+getItemSlots(itemName) - getElementMaxSlots(LocalPlayer)) local value = tonumber( value ) if isPlayerInLoot() then if (getElementData(isPlayerInLoot(), itemName) and getElementData(isPlayerInLoot(), itemName) >= value) then if not isToolbeltItem(itemName) then if (getElementCurrentSlots(localPlayer)+getItemSlots(itemName) <= getElementMaxSlots(localPlayer)) then if not playerMovedInInventory then triggerEvent("onPlayerMoveItemInInventoryFast", getLocalPlayer(), itemName, isPlayerInLoot(),value); playerMovedInInventory = true; setTimer(function() playerMovedInInventory = false; end, 700, 1); else startRollMessage("You can't pick up items that fast!", 255, 22, 0); return; end else triggerEvent("gs_notification_text",getLocalPlayer(),"error","Inventory is full!") return; end else playerMovedInInventory = true; setTimer(function() playerMovedInInventory = false end, 700, 1); triggerEvent("onPlayerMoveItemInInventoryFast", getLocalPlayer(), itemName, isPlayerInLoot(),value); end end if isPlayerInLoot() then setTimer(refreshInventory, 200, 2); setTimer(refreshLoot, 200, 2, getElementData(localPlayer, "currentCol"), guiGetText(inv.label[1])); end end end); 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