Sign in to follow this  
Zakrepe

I need Help.

Recommended Posts

My code have error with this line: local value = ((getElementCurrentSlots(localPlayer)+getItemSlots(itemName)) - getElementMaxSlots(localPlayer))

Error: attempt to perform arithmetic on a boolean value

 

All code: 

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);

 

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.