Best-Killer Posted December 12, 2015 Share Posted December 12, 2015 Client: aGuiForm = nil _gui = nil _root = getRootElement() data={}; addEvent("openGView",true) function aViewGui ( player ) if ( aGuiForm == nil ) then local x, y = guiGetScreenSize() for i=0,9 do data[i] = {}; end data[0].weapon="Sniper" data[1].weapon="Taser" data[2].weapon="Pistol" data[3].weapon="MP5" data[4].weapon="Deagle" data[5].weapon="Ak-47" data[6].weapon="M4" data[7].weapon="Uzi/TEC-9" data[8].weapon="Sawn-Off" data[9].weapon="ShotGun" data[0].price=6000 data[1].price=2500 data[2].price=3000 data[3].price=3500 data[4].price=4500 data[5].price=4500 data[6].price=5000 data[7].price=5000 data[8].price=5500 data[9].price=5500 aGuiForm = guiCreateWindow ( x / 2 - 250, y / 2 - 125, 620, 250, "Skill Shop", false ) aGuiList = guiCreateGridList ( 0.02, 0.09, 0.82, 0.86, true, aGuiForm ) guiGridListAddColumn( aGuiList, "Weapon", 0.50 ) guiGridListAddColumn( aGuiList, "Ammount", 0.80 ) aGuiBuy = guiCreateButton ( 0.86, 0.65, 0.12, 0.09, "Buy", true, aGuiForm ) aGuiClose = guiCreateButton ( 0.86, 0.85, 0.12, 0.09, "Close", true, aGuiForm ) addEventHandler ( "onClientGUIClick", aGuiForm, aClientGuiClick ) aMakeList() end guiSetVisible ( aGuiForm, true ) guiBringToFront ( aGuiForm ) showCursor(true) end addEventHandler ("openGView", _root, aViewGui) function aViewGuiClose ( destroy ) if ( ( destroy ) ) then if ( aGuiForm ) then removeEventHandler ( "onClientGUIClick", aGuiForm, aClientGuiClick ) destroyElement ( aGuiForm ) aGuiForm = nil end else guiSetVisible ( aGuiForm, false ) end end function aClientGuiClick ( button ) if ( button == "left" ) then if ( source == aGuiClose ) then aViewGuiClose ( false ) showCursor(false) elseif ( source == aGuiBuy ) then aViewGuiClose ( false ) showCursor(false) end end end function aMakeList () guiGridListClear(aGuiList) for i,v in pairs(data) do local row = guiGridListAddRow ( aGuiList ) guiGridListSetItemText ( aGuiList, row, 1 , tostring(data[i].weapon) , false, false ) guiGridListSetItemText ( aGuiList, row, 2 , tostring(data[i].price) , false, false ) end end guimarker = createMarker ( -2365, 510.18, 29.31, "cylinder", 1.5, 255, 255, 0, 90 ) function showSkillsgui ( uPlayer ) triggerClientEvent ( uPlayer, "openGView", root ) end addEventHandler ( "onMarkerHit", guimarker, showSkillsgui ) Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 I don't know how to get which gridlist was selected Link to comment
Noki Posted December 12, 2015 Share Posted December 12, 2015 guiGridListGetSelectedItem 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