Jump to content

Window doesnt open when I press [i]


Recommended Posts


    function openIventory(button, press)
	       if button == "i" then
	    showCursor(true)
        invWindow = guiCreateWindow(0.00, 0.00, 1.00, 1.00, "", true)
        guiWindowSetMovable(invWindow, false)
        guiWindowSetSizable(invWindow, false)
        guiSetAlpha(invWindow, 1.00)
        guiSetProperty(invWindow, "CaptionColour", "6CFEFEFE")

        invText = guiCreateLabel(0.01, 0.08, 0.12, 0.05, "Inventory", true, invWindow)
        local font0_invfont = guiCreateFont(":guieditor/fonts/invfont.ttf", 20)
        guiSetFont(invText, font0_invfont)
        guiLabelSetColor(invText, 240, 249, 5)
                 
				 mainWep = guiCreateButton(0.01, 0.16, 0.12, 0.08, "Main Weapon", true, invWindow)
        local font1_secondfont = guiCreateFont(":inventory/secondfont.ttf", 10)
        guiSetFont(mainWep, font1_secondfont)
        guiSetProperty(mainWep, "NormalTextColour", "FEFEFFFF")
                 
				 secWep = guiCreateButton(0.01, 0.30, 0.12, 0.08, "Secondary Weapon", true, invWindow)
        guiSetFont(secWep, font1_secondfont)
        guiSetProperty(secWep, "NormalTextColour", "FFFEFEFE")
               
			   specWep = guiCreateButton(0.01, 0.43, 0.12, 0.08, "Special Weapon", true, invWindow)
        guiSetFont(specWep, font1_secondfont)
        guiSetProperty(specWep, "NormalTextColour", "FFFEFEFE")
                
				cosmOne = guiCreateButton(0.34, 0.16, 0.12, 0.08, "Cosmetic", true, invWindow)
        guiSetFont(cosmOne, font1_secondfont)
        guiSetProperty(cosmOne, "NormalTextColour", "FEFEFEFE")
                
				cosmTwo = guiCreateButton(0.34, 0.30, 0.12, 0.08, "Cosmetic", true, invWindow)
        guiSetFont(cosmTwo, font1_secondfont)
        guiSetProperty(cosmTwo, "NormalTextColour", "FFFEFEFE")
                
				cosmThree = guiCreateButton(0.34, 0.43, 0.12, 0.08, "Cosmetic", true, invWindow)
        guiSetFont(cosmThree, font1_secondfont)
        guiSetProperty(cosmThree, "NormalTextColour", "FFFEFEFE")
               
			   btnClose = guiCreateButton(0.88, 0.94, 0.10, 0.05, "Close", true, invWindow)
        local font2_invfont = guiCreateFont(":guieditor/fonts/invfont.ttf", 10)
        guiSetFont(btnClose, font2_invfont)  
end		
		
		
		function closeInv()
        destroyElement(invWindow)
		showCursor(false)
        end
		
		addEventHandler("onClientGUIClick", btnClose, closeInv)
		
		addEventHandler("onClientKey", root, openInventory)
	  
    end

invWindow should open up when I press i. it doesnt. why?

Link to comment
function openIventory()
	invWindow = guiCreateWindow(0.00, 0.00, 1.00, 1.00, "", true)
	guiSetVisible(invWindow, false)
	guiWindowSetMovable(invWindow, false)
	guiWindowSetSizable(invWindow, false)
	guiSetAlpha(invWindow, 1.00)
	guiSetProperty(invWindow, "CaptionColour", "6CFEFEFE")

	invText = guiCreateLabel(0.01, 0.08, 0.12, 0.05, "Inventory", true, invWindow)
	local font0_invfont = guiCreateFont(":guieditor/fonts/invfont.ttf", 20)
	guiSetFont(invText, font0_invfont)
	guiLabelSetColor(invText, 240, 249, 5)
		 
	mainWep = guiCreateButton(0.01, 0.16, 0.12, 0.08, "Main Weapon", true, invWindow)
	local font1_secondfont = guiCreateFont(":inventory/secondfont.ttf", 10)
	guiSetFont(mainWep, font1_secondfont)
	guiSetProperty(mainWep, "NormalTextColour", "FEFEFFFF")
		 
	secWep = guiCreateButton(0.01, 0.30, 0.12, 0.08, "Secondary Weapon", true, invWindow)
	guiSetFont(secWep, font1_secondfont)
	guiSetProperty(secWep, "NormalTextColour", "FFFEFEFE")
	       
	specWep = guiCreateButton(0.01, 0.43, 0.12, 0.08, "Special Weapon", true, invWindow)
	guiSetFont(specWep, font1_secondfont)
	guiSetProperty(specWep, "NormalTextColour", "FFFEFEFE")
		
	cosmOne = guiCreateButton(0.34, 0.16, 0.12, 0.08, "Cosmetic", true, invWindow)
	guiSetFont(cosmOne, font1_secondfont)
	guiSetProperty(cosmOne, "NormalTextColour", "FEFEFEFE")
		
	cosmTwo = guiCreateButton(0.34, 0.30, 0.12, 0.08, "Cosmetic", true, invWindow)
	guiSetFont(cosmTwo, font1_secondfont)
	guiSetProperty(cosmTwo, "NormalTextColour", "FFFEFEFE")
		
	cosmThree = guiCreateButton(0.34, 0.43, 0.12, 0.08, "Cosmetic", true, invWindow)
	guiSetFont(cosmThree, font1_secondfont)
	guiSetProperty(cosmThree, "NormalTextColour", "FFFEFEFE")
	       
	btnClose = guiCreateButton(0.88, 0.94, 0.10, 0.05, "Close", true, invWindow)
	local font2_invfont = guiCreateFont(":guieditor/fonts/invfont.ttf", 10)
	guiSetFont(btnClose, font2_invfont)  
end	
addEventHandler( "onClientResourceStart", resourceRoot, openIventory)

function bind()
	guiSetVisible(invWindow, not guiGetVisible(invWindow))
	showCursor(guiGetVisible(invWindow))
end
bindKey("i", "down", bind)

 

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...