Jacobob14 Posted February 24, 2014 Share Posted February 24, 2014 as I can do to give that a click in a row is visible the function draw1 weapon = guiCreateGridList(320, 173, 218, 344, false) guiSetVisible(weapon, false) closed = guiCreateButton(165, 321, 56, 22, "", false, weapon) comprar = guiCreateButton(0, 320, 52, 23, "", false, weapon) guiSetAlpha(closed, 0) guiSetAlpha(comprar, 0) guiGridListAddColumn(weapon, "Weapon list", 0.3) guiGridListAddColumn(weapon, "Municion", 0.3) guiGridListAddColumn(weapon, "Price $", 0.3) for i = 1, 18 do guiGridListAddRow(weapon) end guiGridListSetItemText(weapon, 0, 1, "Pistol", false, false) guiGridListSetItemText(weapon, 0, 2, "-", false, false) guiGridListSetItemText(weapon, 0, 3, "400 $", false, false) guiGridListSetItemText(weapon, 1, 1, "Deagle", false, false) guiGridListSetItemText(weapon, 1, 2, "-", false, false) guiGridListSetItemText(weapon, 1, 3, "500 $", false, false) guiGridListSetItemText(weapon, 2, 1, "Shotgun", false, false) guiGridListSetItemText(weapon, 2, 2, "-", false, false) guiGridListSetItemText(weapon, 2, 3, "750 $", false, false) guiGridListSetItemText(weapon, 3, 1, "Recortada", false, false) guiGridListSetItemText(weapon, 3, 2, "-", false, false) guiGridListSetItemText(weapon, 3, 3, "750 $", false, false) guiGridListSetItemText(weapon, 4, 1, "Spaz", false, false) guiGridListSetItemText(weapon, 4, 2, "-", false, false) guiGridListSetItemText(weapon, 4, 3, "2000 $", false, false) function draw1() dxDrawRectangle(569, 182, 193, 176, tocolor(7, 0, 0, 91), false) dxDrawRectangle(569, 182, 193, 20, tocolor(136, 136, 136, 254), false) dxDrawText("Weapon Image", 599, 182, 734, 197, tocolor(255, 255, 255, 255), 0.60, "bankgothic", "left", "top", false, false, true, false, false) dxDrawImage(574, 206, 182, 138, "shop/fotos/M4.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("buy now !!", 569, 341, 687, 354, tocolor(0, 0, 0, 254), 0.60, "bankgothic", "left", "top", false, false, true, false, false) end Link to comment
Wei Posted February 24, 2014 Share Posted February 24, 2014 function drawOnRowClick() row = guiGridListGetSelectedItem() name = guiGridListGetItemText(weapon, row, 1) if (name) then addEventHandler("onClientRender", root, draw1) end end addEventHandler("onClientGUIClick", weapon, drawOnRowClick) Link to comment
Jacobob14 Posted February 24, 2014 Author Share Posted February 24, 2014 I does not work Link to comment
Castillo Posted February 24, 2014 Share Posted February 24, 2014 function drawOnRowClick() row = guiGridListGetSelectedItem() name = guiGridListGetItemText(weapon, row, 1) if (name) then addEventHandler("onClientRender", root, draw1) end end addEventHandler("onClientGUIClick", weapon, drawOnRowClick) Missing "weapon" ( grid list ) at guiGridListGetSelectedItem. Link to comment
Jacobob14 Posted February 24, 2014 Author Share Posted February 24, 2014 function drawOnRowClick() local row = guiGridListGetSelectedItem ( weapon ) if ( row == 0 ) then addEventHandler("onClientRender", root, draw1) elseif ( row == 1 ) then addEventHandler("onClientRender", root, draw2) end end addEventHandler("onClientGUIClick", weapon, drawOnRowClick) I did not if it will be fine Link to comment
Moderators Citizen Posted February 24, 2014 Moderators Share Posted February 24, 2014 function drawOnRowClick() local row = guiGridListGetSelectedItem ( weapon ) if ( row == 0 ) then addEventHandler("onClientRender", root, draw1) elseif ( row == 1 ) then addEventHandler("onClientRender", root, draw2) end end addEventHandler("onClientGUIClick", weapon, drawOnRowClick) I did not if it will be fine It will, but only in specific case. That's why your code shouldn't be used because it's dirty (duplication of code: draw1, draw2 ..; not removing event handler before adding another etc). So please dont. 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