-.Paradox.- Posted December 13, 2013 Share Posted December 13, 2013 Hello, i was searching in forum about a weapon inventory, and i found this, but i don't know why it doesnt work, here is the code thanks. local player = getLocalPlayer() tab = guiCreateTabPanel(429, 151, 430, 404, true) tab_inventory = guiCreateTab("Weapon:", tab) inventory_gridlist = guiCreateGridList (0.03, 0.03, 0.46, 0.94, true, tab_inventory) weapSlots = guiGridListAddColumn(inventory_gridlist, "slots", 0.9) function weapItemInInventory ( ) if ( weapSlots ) then for slot = 1, 12 do local weapon = getPedWeapon ( localPlayer, slot ) if ( weapon > 0 ) then local row = guiGridListAddRow ( inventory_gridlist ) guiGridListSetItemText ( inventory_gridlist, row, weapSlots, getWeaponNameFromID ( weapon ), false, false ) end end end end addEventHandler ( "onClientResourceStart", getResourceRootElement(), weapItemInInventory ) setTimer ( function ( ) guiGridListClear ( inventory_gridlist ) weapItemInInventory ( ) end, 5000, 0 ) function enableInv() if guiGetVisible(tab) == false then guiSetVisible(tab, true) showCursor(true) else guiSetVisible(tab, false) showCursor(false) end end bindKey("B","down", enableInv) Link to comment
-.Paradox.- Posted December 13, 2013 Author Share Posted December 13, 2013 No nothing Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 And what is the problem exactly? Link to comment
-.Paradox.- Posted December 13, 2013 Author Share Posted December 13, 2013 The gui dont want to open i can see only cursor Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 Looks like it's a position problem, since I've centered it using a function and the tab panel shown up. local sx, sy = guiGetScreenSize ( ) function centerGUI ( guiElement ) local width, height = guiGetSize ( guiElement, false ) local x, y = ( sx / 2 - width / 2 ), ( sy / 2 - height / 2 ) guiSetPosition ( guiElement, x, y, false ) end tab = guiCreateTabPanel(429, 151, 430, 404, true) guiSetVisible ( tab, false ) centerGUI ( tab ) tab_inventory = guiCreateTab("Weapon:", tab) inventory_gridlist = guiCreateGridList (0.03, 0.03, 0.46, 0.94, true, tab_inventory) weapSlots = guiGridListAddColumn(inventory_gridlist, "slots", 0.9) function weapItemInInventory ( ) if ( weapSlots ) then for slot = 1, 12 do local weapon = getPedWeapon ( localPlayer, slot ) if ( weapon > 0 ) then local row = guiGridListAddRow ( inventory_gridlist ) guiGridListSetItemText ( inventory_gridlist, row, weapSlots, getWeaponNameFromID ( weapon ), false, false ) end end end end addEventHandler ( "onClientResourceStart", getResourceRootElement(), weapItemInInventory ) setTimer ( function ( ) guiGridListClear ( inventory_gridlist ) weapItemInInventory ( ) end, 5000, 0 ) function enableInv ( ) local state = ( not guiGetVisible ( tab ) ) guiSetVisible(tab, state) showCursor ( state ) end bindKey ( "B", "down", enableInv ) Link to comment
-.Paradox.- Posted December 14, 2013 Author Share Posted December 14, 2013 Working thanks, but it show a big tab and i want only small one and thanks again. Link to comment
Castillo Posted December 14, 2013 Share Posted December 14, 2013 Well, you must change the position of it, I added to center it just for test. Link to comment
-.Paradox.- Posted December 14, 2013 Author Share Posted December 14, 2013 I changed it Link to comment
Castillo Posted December 14, 2013 Share Posted December 14, 2013 And is working fine? Link to comment
-.Paradox.- Posted December 14, 2013 Author Share Posted December 14, 2013 Yes it's working but the tab is on all the screen, still the same problem, shall i remove center? Link to comment
Castillo Posted December 14, 2013 Share Posted December 14, 2013 Well, that function only centers it, it doesn't resize it. Link to comment
-.Paradox.- Posted December 22, 2013 Author Share Posted December 22, 2013 So how can i fix it? 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