brocky Posted November 5, 2015 Share Posted November 5, 2015 Hi, Can anyone help me in creating a small functional Gridlist. I have tried a lot but it never works out for me. Can you give me a small code of Gridlist. for example. 2 weapons in gridlist and when you click the weapon and click "ok", you will get that weapon. I need the code with some comments in detail if you can. Hope you understood. Thanks. Link to comment
TAPL Posted November 5, 2015 Share Posted November 5, 2015 I have tried a lot but it never works out for me Post those tries. Link to comment
brocky Posted November 5, 2015 Author Share Posted November 5, 2015 ok wait a minute. Link to comment
brocky Posted November 5, 2015 Author Share Posted November 5, 2015 I know that I have made many mistakes and they are epic, but I am bad in making gridlist and I need your help. addEventHandler("onClientResourceStart", resourceRoot, function() window1 = guiCreateWindow(245, 209, 309, 271, "", false) guiWindowSetSizable(window1, false) gridlist1 = guiCreateGridList(9, 21, 290, 176, false, window1) guiGridListAddColumn(gridlist1, "Weapons", 0.9) guiGridListAddRow(gridlist1) text = guiGridListSetItemText(gridlist1, 0, 1, "m4", false, false) button1 = guiCreateButton(9, 205, 290, 56, "OK", false, window1) function getWeapon() if button1 == source then if guiGridListGetSelectedItem(v[1]) then triggerServerEvent("giveMe", localPlayer) end end end addEventHandler("onClientGUIClick", button1, getWeapon, false) end ) Link to comment
Aristates Posted November 5, 2015 Share Posted November 5, 2015 addEventHandler('onClientGUIClick', root, function() if source == button1 then if guiGridListGetSelectedItem ( gridlist1 ) ~= -1 then ids = guiGridListGetSelectedItem ( gridlist1 ) givePedWeapon(source, ids, 5000, true) end end end ) Link to comment
LoOs Posted November 6, 2015 Share Posted November 6, 2015 addEventHandler('onClientGUIClick', root, function() if source == button1 then if guiGridListGetSelectedItem ( gridlist1 ) ~= -1 then ids = guiGridListGetSelectedItem ( gridlist1 ) givePedWeapon(source, ids, 5000, true) end end end ) givePedWeapon(source, ids, 5000, true) source ?? source = GuiClick not ped , and 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