I am a beginner regarding the Lua language, the problem is very simple actually when I enter the server the panel to change the weather overrides the login panel I wanted to make it be activated only by bind ie when starting the server it would be set to off and pressing bind appears ..
GUIEditor = {
button = {},
label = {}
}
addEventHandler('onClientResourceStart', resourceRoot,
function()
wnd = guiCreateWindow(812, 300, 301, 423, "Painel Clima", false, wnd)
guiWindowSetSizable(wnd, false)
guiSetAlpha(wnd, 0.97)
guiSetProperty(wnd, "CaptionColour", "FF0988F3")
showCursor(true)
close = guiCreateButton(9, 22, 24, 23, "X", true, wnd)
guiSetAlpha(close, 0.80)
guiSetFont(close, "default-bold-small")
guiSetProperty(close, "NormalTextColour", "FFFB0000")
cloud = guiCreateButton(10, 86, 130, 36, "Névoa", false, wnd)
guiSetAlpha(cloud, 0.80)
guiSetFont(cloud, "default-bold-small")
guiSetProperty(cloud, "NormalTextColour", "FF243DDA")
rain = guiCreateButton(9, 132, 130, 36, "Chuva", false, wnd)
guiSetAlpha(rain, 0.80)
guiSetFont(rain, "default-bold-small")
guiSetProperty(rain, "NormalTextColour", "FFEC116E")
sun = guiCreateButton(9, 178, 130, 37, "Ensolarado", true, wnd)
guiSetAlpha(sun, 0.80)
guiSetFont(sun, "default-bold-small")
guiSetProperty(sun, "NormalTextColour", "FFF4FD00")
GUIEditor.label[1] = guiCreateLabel(34, 24, 152, 21, "Fechar", true, wnd)
guiSetFont(GUIEditor.label[1], "default-bold-small")
guiLabelSetColor(GUIEditor.label[1], 43, 109, 207)
bluesky = guiCreateButton(9, 225, 132, 36, "Céu azul", false, wnd)
guiSetFont(bluesky, "default-bold-small")
guiSetProperty(bluesky, "NormalTextColour", "FF09C0F5")
sand = guiCreateButton(9, 271, 130, 37, "Tempestade de areia", false, wnd)
guiSetFont(sand, "default-bold-small")
guiSetProperty(sand, "NormalTextColour", "FFBD8A40")
Dull = guiCreateButton(9, 318, 130, 37, "Nublado", false, wnd)
guiSetFont(Dull, "default-bold-small")
guiSetProperty(Dull, "NormalTextColour", "FF43D12B")
hot = guiCreateButton(9, 365, 130, 37, "Ensolarado", false, wnd)
guiSetFont(hot, "default-bold-small")
guiSetProperty(hot, "NormalTextColour", "FFF35B08")
morning = guiCreateButton(160, 86, 130, 36, "09:00", false, wnd)
guiSetAlpha(morning, 0.80)
guiSetFont(morning, "default-bold-small")
guiSetProperty(morning, "NormalTextColour", "FF17DBF3")
GUIEditor.label[2] = guiCreateLabel(11, 60, 129, 16, "Clima:", false, wnd)
guiSetFont(GUIEditor.label[2], "default-bold-small")
guiLabelSetColor(GUIEditor.label[2], 189, 176, 247)
GUIEditor.label[3] = guiCreateLabel(160, 60, 122, 17, "Tempo:", false, wnd)
guiSetFont(GUIEditor.label[3], "default-bold-small")
guiLabelSetColor(GUIEditor.label[3], 189, 176, 247)
afternoon = guiCreateButton(160, 132, 130, 36, "12:00", false, wnd)
guiSetAlpha(afternoon, 0.80)
guiSetFont(afternoon, "default-bold-small")
guiSetProperty(afternoon, "NormalTextColour", "FF17DBF3")
day = guiCreateButton(160, 179, 130, 36, "15:00", false, wnd)
guiSetAlpha(day, 0.80)
guiSetFont(day, "default-bold-small")
guiSetProperty(day, "NormalTextColour", "FF17DBF3")
beforenight = guiCreateButton(160, 225, 130, 36, "18:00", false, wnd)
guiSetAlpha(beforenight, 0.80)
guiSetFont(beforenight, "default-bold-small")
guiSetProperty(beforenight, "NormalTextColour", "FF17DBF3")
night = guiCreateButton(160, 272, 130, 36, "22:00", false, wnd)
guiSetAlpha(night, 0.80)
guiSetFont(night, "default-bold-small")
guiSetProperty(night, "NormalTextColour", "FF17DBF3")
innight = guiCreateButton(160, 365, 130, 36, "02:00", false, wnd)
guiSetAlpha(innight, 0.80)
guiSetFont(innight, "default-bold-small")
guiSetProperty(innight, "NormalTextColour", "FF17DBF3")
minuit = guiCreateButton(160, 319, 130, 36, "00:00", false, wnd)
guiSetAlpha(minuit, 0.80)
guiSetFont(minuit, "default-bold-small")
guiSetProperty(minuit, "NormalTextColour", "FF17DBF3")
GUIEditor.label[4] = guiCreateLabel(9, 403, 130, 15, "edited by Sweather", false, wnd)
guiSetAlpha(GUIEditor.label[4], 0.45)
guiSetFont(GUIEditor.label[4], "default-small")
guiLabelSetColor(GUIEditor.label[4], 154, 146, 146)
end
)
---------------------------------------------------------------
----------------------[Closing The window]---------------------
addEventHandler("onClientGUIClick", root, -- Event
function() -- Function
if ( source == close ) then -- Chick
guiSetVisible ( wnd , false)-- Show Window ( false = Visible! )
showCursor(false)
end -- Close( if )
end -- Close Function
) -- Close Event
------------------------------------------------------------
-----------------------[Weathers]---------------------------
function onGuiClick (button, state, absoluteX, absoluteY)
if (source == rain) then
setWeather ( 16 )
elseif (source == sun) then
setWeather ( 11 )
elseif (source == cloud) then
setWeather ( 9 )
elseif (source == bluesky) then
setWeather (10)
elseif (source == sand) then
setWeather (19)
elseif (source == hot) then
setWeather (18)
elseif (source == Dull) then
setWeather (12)
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick)
--------------------------------------------------------------------
----------------------------[Time]----------------------------------
function onGuiClick (button, state, absoluteX, absoluteY)
if (source == morning) then
setTime( 09, 0 )
elseif (source == afternoon) then
setTime( 12, 0 )
elseif (source == day) then
setTime( 15, 0 )
elseif (source == beforenight) then
setTime (18, 0)
elseif (source == night) then
setTime (22, 0)
elseif (source == innight) then
setTime (02, 0)
elseif (source == minuit) then
setTime (00,0)
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick)
--------------------------------------------------------------------
----------------------[open the window]-----------------------------
function open()
guiSetVisible(wnd,not guiGetVisible(wnd))
showCursor(guiGetVisible(wnd))
end
bindKey("F6","down",open)