Jump to content

GUIClick bug..


Recommended Posts

Hi guys!

I have a bit problem.

Im download Drawtag 1.1 resource and when i typing "/draw" then i see the gui window and it working.

When i open the inventory and i click for item, after i open the draw but the buttons doesnt working. The buttons is: clear, close and done button.

Sorry for my bad English.

Drawtag 1.1 code

function createDrawingWindow() 
    local sw,sh = guiGetScreenSize() 
    draw_window = guiCreateWindow((sw-512)*0.5,(sh-384)*0.5,512,384,"Drawing",false) 
    guiWindowSetSizable(draw_window,false) 
    button_close = guiCreateButton(352,304,96,32,"Close",false,draw_window) 
    button_done = guiCreateButton(304,344,64,24,"Done",false,draw_window) 
    button_clear = guiCreateButton(432,344,64,24,"Clear",false,draw_window) 
    guiSetVisible(draw_window,false) 
    setDefaultColors() 
    brush_size = 4 
    drawdest = dxCreateRenderTarget(256,256,true) 
    erasedest = dxCreateRenderTarget(256,256,false) 
    if not drawdest or not erasedest then return end 
    black = tocolor(0,0,0,255) 
    white = tocolor(255,255,255,255) 
    green = tocolor(0,128,0,255) 
    midblue = tocolor(0,0,192,255) 
    red = tocolor(255,0,0,255) 
    lime = tocolor(0,255,0,255) 
    blue = tocolor(0,0,255,255) 
    transparent = tocolor(255,255,255,128) 
    addEventHandler("onClientGUIClick", button_close, buttonCloseDrawingWindow, false) 
    addEventHandler("onClientGUIClick", button_done, buttonDoneDrawing, false) 
    addEventHandler("onClientGUIClick", button_clear, buttonClearImage, false) 
    brush_preview_bg = white 
end 

Inventory code

function showChemistrySet() 
    if not (wItems) then 
        if not (wChemistrySet) then 
            local width, height = 600, 500 
            local scrWidth, scrHeight = guiGetScreenSize() 
            local x = scrWidth/2 - (width/2) 
            local y = scrHeight/2 - (height/2) 
             
            wChemistrySet = guiCreateWindow(x, y, width, height, "Kémia szett", false) 
            guiWindowSetSizable(wChemistrySet, false) 
             
            local items = getItems(getLocalPlayer()) 
                     
            chemItems = { } 
             
            if items then 
                for slot, item in ipairs(items) do 
                    if item and item[1] >= 30 and item[1] <= 33 then 
                        chemItems[slot] = { } 
                        chemItems[slot][1] = getItemName(item[1]) 
                        chemItems[slot][2] = item[1] 
                        chemItems[slot][3] = slot 
                    end 
                end 
            end 
             
             
            -- ITEMS 
            gChemicals = guiCreateGridList(0.025, 0.05, 0.95, 0.85, true, wChemistrySet) 
             
            colChemSlot = guiGridListAddColumn(gChemicals, "Hely", 0.1) 
            colChemName = guiGridListAddColumn(gChemicals, "Név", 0.855) 
             
            guiGridListSetSelectionMode(gChemicals, 1) 
             
            for k, v in pairs(chemItems) do 
                local itemid = tonumber(chemItems[k][2]) 
  
                local itemtype = getItemType(itemid) 
             
                if (itemtype) then 
                    local row = guiGridListAddRow(gChemicals) 
                    guiGridListSetItemText(gChemicals, row, colChemSlot, tostring(chemItems[k][3]), false, true) 
                    guiGridListSetItemText(gChemicals, row, colChemName, tostring(chemItems[k][1]), false, false) 
                end 
            end 
  
            -- buttons 
            bMixItems = guiCreateButton(0.05, 0.91, 0.7, 0.15, "Kiválasztottak összekeverése", true, wChemistrySet) 
            addEventHandler("onClientGUIClick", bMixItems, mixItems, false) 
            guiSetEnabled(bMixItems, false) 
             
            bChemClose = guiCreateButton(0.8, 0.91, 0.15, 0.15, "Bezárás", true, wChemistrySet) 
  
            addEventHandler("onClientGUIClick", gChemicals, checkSelectedItems, false) 
            addEventHandler("onClientGUIClick", bChemClose, hideChemistrySet, false) 
            showCursor(true) 
        else 
            hideChemistrySet() 
        end 
    end 
end 

Link to comment

function showItemList() 
    if getElementData(getLocalPlayer(), "adminlevel") == 0 then 
        return 
    end 
    if not (wItemsList) then 
        wItemsList = guiCreateWindow(0.15, 0.15, 0.7, 0.7, "Items List", true) 
        local gridItems = guiCreateGridList(0.025, 0.1, 0.95, 0.775, true, wItemsList) 
         
        local colID = guiGridListAddColumn(gridItems, "ID", 0.1) 
        local colName = guiGridListAddColumn(gridItems, "Tárgy neve", 0.3) 
        local colDesc = guiGridListAddColumn(gridItems, "Leírás", 0.6) 
         
        for key, value in pairs(g_items) do 
            if key ~= 74 and key ~= 75 then 
                local row = guiGridListAddRow(gridItems) 
                guiGridListSetItemText(gridItems, row, colID, tostring(key), false, true) 
                guiGridListSetItemText(gridItems, row, colName, value[1], false, false) 
                guiGridListSetItemText(gridItems, row, colDesc, value[2], false, false) 
            end 
        end 
  
        bItemListClose = guiCreateButton(0.025, 0.9, 0.95, 0.1, "Bezárás", true, wItemsList) 
        addEventHandler("onClientGUIClick", bItemListClose, closeItemsList, false) 
         
        showCursor(true) 
    else 
        guiSetVisible(wItemsList, true) 
        guiBringToFront(wItemsList) 
        showCursor(true) 
    end 
end 

  
function showChemistrySet() 
    if not (wItems) then 
        if not (wChemistrySet) then 
            local width, height = 600, 500 
            local scrWidth, scrHeight = guiGetScreenSize() 
            local x = scrWidth/2 - (width/2) 
            local y = scrHeight/2 - (height/2) 
             
            wChemistrySet = guiCreateWindow(x, y, width, height, "Kémia szett", false) 
            guiWindowSetSizable(wChemistrySet, false) 
             
            local items = getItems(getLocalPlayer()) 
                     
            chemItems = { } 
             
            if items then 
                for slot, item in ipairs(items) do 
                    if item and item[1] >= 30 and item[1] <= 33 then 
                        chemItems[slot] = { } 
                        chemItems[slot][1] = getItemName(item[1]) 
                        chemItems[slot][2] = item[1] 
                        chemItems[slot][3] = slot 
                    end 
                end 
            end 
             
             
            -- ITEMS 
            gChemicals = guiCreateGridList(0.025, 0.05, 0.95, 0.85, true, wChemistrySet) 
             
            colChemSlot = guiGridListAddColumn(gChemicals, "Hely", 0.1) 
            colChemName = guiGridListAddColumn(gChemicals, "Név", 0.855) 
             
            guiGridListSetSelectionMode(gChemicals, 1) 
             
            for k, v in pairs(chemItems) do 
                local itemid = tonumber(chemItems[k][2]) 
  
                local itemtype = getItemType(itemid) 
             
                if (itemtype) then 
                    local row = guiGridListAddRow(gChemicals) 
                    guiGridListSetItemText(gChemicals, row, colChemSlot, tostring(chemItems[k][3]), false, true) 
                    guiGridListSetItemText(gChemicals, row, colChemName, tostring(chemItems[k][1]), false, false) 
                end 
            end 
  
            -- buttons 
            bMixItems = guiCreateButton(0.05, 0.91, 0.7, 0.15, "Kiválasztottak összekeverése", true, wChemistrySet) 
            addEventHandler("onClientGUIClick", bMixItems, mixItems, false) 
            guiSetEnabled(bMixItems, false) 
             
            bChemClose = guiCreateButton(0.8, 0.91, 0.15, 0.15, "Bezárás", true, wChemistrySet) 
  
            addEventHandler("onClientGUIClick", gChemicals, checkSelectedItems, false) 
            addEventHandler("onClientGUIClick", bChemClose, hideChemistrySet, false) 
            showCursor(true) 
        else 
            hideChemistrySet() 
        end 
    end 
end 

function showItemList() 
    if getElementData(getLocalPlayer(), "adminlevel") == 0 then 
        return 
    end 
    if not (wItemsList) then 
        wItemsList = guiCreateWindow(0.15, 0.15, 0.7, 0.7, "Items List", true) 
        local gridItems = guiCreateGridList(0.025, 0.1, 0.95, 0.775, true, wItemsList) 
         
        local colID = guiGridListAddColumn(gridItems, "ID", 0.1) 
        local colName = guiGridListAddColumn(gridItems, "Tárgy neve", 0.3) 
        local colDesc = guiGridListAddColumn(gridItems, "Leírás", 0.6) 
         
        for key, value in pairs(g_items) do 
            if key ~= 74 and key ~= 75 then 
                local row = guiGridListAddRow(gridItems) 
                guiGridListSetItemText(gridItems, row, colID, tostring(key), false, true) 
                guiGridListSetItemText(gridItems, row, colName, value[1], false, false) 
                guiGridListSetItemText(gridItems, row, colDesc, value[2], false, false) 
            end 
        end 
  
        bItemListClose = guiCreateButton(0.025, 0.9, 0.95, 0.1, "Bezárás", true, wItemsList) 
        addEventHandler("onClientGUIClick", bItemListClose, closeItemsList, false) 
         
        showCursor(true) 
    else 
        guiSetVisible(wItemsList, true) 
        guiBringToFront(wItemsList) 
        showCursor(true) 
    end 
end 

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