Jump to content

Please help me


Zakrepe

Recommended Posts

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...