Jump to content

Bottone per chiudere una finestra


Recommended Posts

Salve, ecco il codice di una finestra che sto creando:

--[[------------------------------------------------- 
Notes: 
  
> This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. 
    To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. 
--]]------------------------------------------------- 
  
  
GUIEditor = { 
    tab = {}, 
    staticimage = {}, 
    tabpanel = {}, 
    label = {}, 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0.13, 0.07, 0.73, 0.79, "Introduction", true) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFE81414") 
  
        GUIEditor.tabpanel[1] = guiCreateTabPanel(44, 112, 695, 709, false, GUIEditor.window[1]) 
  
        GUIEditor.tab[1] = guiCreateTab("StoryLine", GUIEditor.tabpanel[1]) 
  
        GUIEditor.label[1] = guiCreateLabel(10, 10, 632, 657, "Si è sviluppata una grave infezione all'interno di BaySide, inizialmente una cittadina tranquilla, ma che dopo poche ore si è trasformata nel caos puro! L'esercito Statunitense ha subito demolito il ponte che collegava l'isola alla terra ferma. Tutte le strade sono state chiuse, il mare inacidito. Solo tu e pochi altri siete sopravvissuti! Il Presidente ha affermato che solo uccidendo il maggior numero di zombie e quindi accumulando soldi si potrà comprare l'unica barca in grado di portarti via dall'isola e salvarti! Quindi, uccidi gli zombi, fai soldi, comprati una casa. All'interno di essa vi saranno approvvigionamenti e armi. Potrai far gruppo con degli amici ed insieme combattere quegli esseri, o combattere da soli, da veri mercenari!", false, GUIEditor.tab[1]) 
        guiSetFont(GUIEditor.label[1], "clear-normal") 
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", true) 
  
        GUIEditor.staticimage[1] = guiCreateStaticImage(10, 157, 279, 236, ":guieditor/images/ponte_giorno.png", false, GUIEditor.label[1]) 
        GUIEditor.staticimage[2] = guiCreateStaticImage(343, 157, 279, 236, ":guieditor/images/ponte_notte.png", false, GUIEditor.label[1]) 
  
  
        GUIEditor.tab[2] = guiCreateTab("Commands", GUIEditor.tabpanel[1]) 
        GUIEditor.tab[3] = guiCreateTab("Staff", GUIEditor.tabpanel[1]) 
  
        GUIEditor.label[2] = guiCreateLabel(212, 11, 172, 42, "Founders", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[2], 223, 8, 
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) 
        GUIEditor.label[3] = guiCreateLabel(200, 43, 194, 57, "GHOST    THE_DARK_KING", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) 
        GUIEditor.label[4] = guiCreateLabel(210, 110, 172, 42, "Admins", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[4], 215, 101, 17) 
        guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false) 
        GUIEditor.label[5] = guiCreateLabel(200, 142, 194, 57, "NONE", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[5], "center", false) 
        GUIEditor.label[6] = guiCreateLabel(212, 209, 172, 42, "SuperModerators", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[6], 210, 187, 36) 
        guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", false) 
        GUIEditor.label[7] = guiCreateLabel(200, 241, 194, 57, "NONE", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false) 
        GUIEditor.label[8] = guiCreateLabel(494, 557, 187, 121, "We seek staff", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[8], 223, 7, 7) 
        guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false) 
        GUIEditor.label[9] = guiCreateLabel(212, 308, 172, 42, "Moderators", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[9], 80, 255, 45) 
        guiLabelSetHorizontalAlign(GUIEditor.label[9], "center", false) 
        GUIEditor.label[10] = guiCreateLabel(200, 340, 194, 57, "NONE", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[10], "center", false) 
        GUIEditor.label[11] = guiCreateLabel(210, 407, 172, 42, "Builders", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[11], 45, 188, 255) 
        guiLabelSetHorizontalAlign(GUIEditor.label[11], "center", false) 
        GUIEditor.label[12] = guiCreateLabel(198, 439, 194, 57, "NONE", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[12], "center", false) 
        GUIEditor.label[13] = guiCreateLabel(18, 11, 172, 42, "Console", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[13], 149, 0, 0) 
        guiLabelSetHorizontalAlign(GUIEditor.label[13], "center", false) 
        GUIEditor.label[14] = guiCreateLabel(212, 506, 172, 42, "Helpers", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[14], 133, 0, 189) 
        guiLabelSetHorizontalAlign(GUIEditor.label[14], "center", false) 
        GUIEditor.label[15] = guiCreateLabel(210, 407, 172, 42, "Builders", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[15], 45, 188, 255) 
        guiLabelSetHorizontalAlign(GUIEditor.label[15], "center", false) 
        GUIEditor.label[16] = guiCreateLabel(198, 538, 194, 57, "NONE", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[16], "center", false) 
        GUIEditor.label[17] = guiCreateLabel(10, 569, 172, 42, "Mercenary", false, GUIEditor.tab[3]) 
        guiLabelSetColor(GUIEditor.label[17], 255, 195, 254) 
        guiLabelSetHorizontalAlign(GUIEditor.label[17], "center", false) 
        GUIEditor.label[18] = guiCreateLabel(10, 595, 172, 46, "NONE", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[18], "center", false) 
        GUIEditor.label[19] = guiCreateLabel(10, 43, 194, 57, "GHOST", false, GUIEditor.tab[3]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[19], "center", false) 
  
  
        GUIEditor.button[1] = guiCreateButton(0.87, 0.92, 0.12, 0.07, "CLOSE", true, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFD76511") 
  
        GUIEditor.staticimage[3] = guiCreateStaticImage(0.73, 0.27, 0.15, 0.36, ":guieditor/images/cross.png", true, GUIEditor.button[1])     
    end 
) 

Ora, vorrei far si che il bottone che ha come testo "CLOSE" e un immaginina con la X, una volta premuto, faccia chiudere la finestra con tutti i suoi sottoelementi (label ecc...)

Come posso fare? Scusate ma è il mio primo codice trololol

Link to comment
  
function onGuiClick (button, state, absoluteX, absoluteY) 
if (source == GUIEditor.button[1]) then 
guiSetVisible (GUIEditor.window[1],false) 
end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  

Aggiungi questa funzione sotto.

Se hai altri problemi postali qui o fai un solo topic per le informazioni,evita di fare molti post.

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