Jump to content

help gui panel


Jacobob14

Recommended Posts

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
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
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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...