ali Posted February 19, 2013 Share Posted February 19, 2013 this is a part of my script stuff = { {"Special Skin"}, {"Jetpack"}, {"Sniper Bullet"}, } for i,v in ipairs(stuff) do row = guiGridListAddRow(grid) -- guiGridListSetItemText(grid, row, 1, tostring(v[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(v[2])) end i want that when a player double clicks on anyone of the rows it triggers a server event Link to comment
Sparrow Posted February 19, 2013 Share Posted February 19, 2013 "onClientGUIDoubleClick" Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 i know the event i just want to know how to use it in my script Link to comment
Sparrow Posted February 19, 2013 Share Posted February 19, 2013 this is it: function test() if (source == gridList) then local object = guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1) if (guiGridListGetSelectedItem(gridList) ~= -1) then triggerServerEvent("eventInServer", getLocalPlayer(), object) end end end addEventHandler("onClientGUIDoubleClick", root, test) Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 yes but now i need to know how to trigger the next 2? Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 Next two what? that should work for all the items of the grid list. Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 there is a problem where ever i click on gridlist the things happen Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 "the things happen" what does that mean? you are not explaining us anything. Also, this line: addEventHandler("onClientGUIDoubleClick", root, test) Should be: addEventHandler("onClientGUIDoubleClick", root, test, false) Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 i mean where ever i click on the gridlist i get the skin , sniper bullet and jetpack Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 Post the whole script. Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 (edited) Client side GUIEditor_Image = {} panel = guiCreateWindow(252,61,636,489,"VIP Panel",false) grid = guiCreateGridList(10,22,617,184,false,panel) guiGridListSetSelectionMode(grid,2) guiGridListAddColumn(grid,"VIP stuff ",0.2) GUIEditor_Image[1] = guiCreateStaticImage(10,213,613,267,"images/ali.jpg",false,panel) guiSetVisible(panel, false) showCursor(false) function show () visible = guiGetVisible(panel) if visible == false then guiSetVisible(panel, true) showCursor(true) else guiSetVisible(panel, false) showCursor(false) end end addCommandHandler("open",show ) stuff = { {"Special Skin"}, {"Jetpack"}, {"Sniper Bullet"}, } for i,v in ipairs(stuff) do row = guiGridListAddRow(grid) -- guiGridListSetItemText(grid, row, 1, tostring(v[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(v[2])) end Notice( i removed sparrow's info ) Edited February 19, 2013 by Guest Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 And the server side? Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 function skins() setElementModel( source, 255 ) end addEvent("Skin",true) addEventHandler("Skin", getRootElement(), skins ) function Jet() if doesPedHaveJetPack ( source ) then removePedJetPack ( source ) else givePedJetPack ( source ) end end addEvent("JetPack",true) addEventHandler("JetPack", getRootElement(), Jet ) function wep ( ) giveWeapon( source, 34, 5 ) end addEvent("Sniper", true) addEventHandler("Sniper", getRootElement(), wep ) Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 Post the whole client side, the one you posted has missing trigger events. Link to comment
ali Posted February 19, 2013 Author Share Posted February 19, 2013 i removed it because i couldn't understand that part 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