Jump to content

[HELP] Mta Close Button


Recommended Posts

GUIEditor = {
    gridlist = {},
    staticimage = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function ()
local screenW, screenH = guiGetScreenSize()
        win = guiCreateStaticImage((screenW - 554) / 2, (screenH - 477) / 2, 554, 477, "s/panel.png", false)
		
		guiSetVisible(win,false)
		local screenW2, screenH2 = guiGetScreenSize()
        PlayerList = guiCreateStaticImage((screenW2 - 342) / 2, (screenH2 - 415) / 2, 342, 415, "s/PlayerList.png", false)
		guiSetVisible(PlayerList,false)
        GridPlayer = guiCreateGridList(23, 59, 188, 346, false, PlayerList)
        c = guiGridListAddColumn(GridPlayer, "Player", 0.9)
        SendWe = guiCreateStaticImage(215, 59, 101, 32, "s/SendWe.png", false, PlayerList)
        Close = guiCreateStaticImage(215, 117, 101, 32, "s/Close.png", false, PlayerList)
        GUIEditor.staticimage[1] = guiCreateStaticImage(216, 315, 104, 90, "s/logo.png", false, PlayerList) 
                for _,player in ipairs ( getElementsByType("player") ) do 
                local row = guiGridListAddRow(GridPlayer) 
                guiGridListSetItemText(GridPlayer,row,1,getPlayerName(player),false,false)
				end
        Grid = guiCreateGridList(16, 71, 277, 400, false, win)
		guiGridListAddColumn(Grid, "name", 0.2)
		guiGridListAddColumn(Grid, "id", 0.2)
		guiGridListAddColumn(Grid, "ammo", 0.2)
		guiGridListAddColumn(Grid, "price", 0.2)
		for k,v in ipairs(Weapons) do
		local row = guiGridListAddRow(Grid)
		guiGridListSetItemText(Grid,row,1, v[1],false,false)
		guiGridListSetItemText(Grid,row,2, v[2],false,false)
		guiGridListSetItemText(Grid,row,3, v[3],false,false)
		guiGridListSetItemText(Grid,row,4, v[4],false,false)
		guiGridListSetItemText(Grid,row,5, v[5],false,false)
		guiGridListSetItemText(Grid,row,6, v[6],false,false)
		guiGridListSetItemText(Grid,row,7, v[7],false,false)
		guiGridListSetItemText(Grid,row,8, v[8],false,false)
		guiGridListSetItemText(Grid,row,9, v[9],false,false)
		guiGridListSetItemText(Grid,row,10, v[10],false,false)
		guiGridListSetItemText(Grid,row,11, v[11],false,false)
		guiGridListSetItemText(Grid,row,12, v[12],false,false)
		guiGridListSetItemText(Grid,row,13, v[13],false,false)
        Close1 = guiCreateStaticImage(215, 117, 101, 32, "s/Close.png", false, win) -- I want it to close the window. I tried several ways but no result.   
        Buy = guiCreateStaticImage(320, 95, 200, 60, "s/Buy.png", false, win)
        Send = guiCreateStaticImage(320, 224, 200, 60, "s/Send.png", false, win)
        GUIEditor.staticimage[4] = guiCreateStaticImage(352, 339, 170, 132, "s/logo.png", false, win)  
  
    end
end)

I want it to close the window. I tried several ways but no result.

Link to comment
function togglePanel()
    local isVisible = guiGetVisible(win)
    if isVisible then
        guiSetVisible(win, false)
        showCursor(false)
    else
        guiSetVisible(win, true)
        showCursor(true)
    end
end
addEventHandler("onClientGUIClick", Close1, togglePanel, false)
-- change the command to whatever u like
addCommandHandler("togglepanel", togglePanel)

Add this function and remove on close function

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