papam77 Posted July 23, 2013 Share Posted July 23, 2013 ----------------------------- -- Userpanel Design --------- ----------------------------- local ikony = { ["pohar"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/1.png", true), -- Obdélník ["ovladac"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/5.png", true), -- Čtverec ["sluchatka"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/7.png", true), -- Čtverec ["taska"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/9.png", true), -- Čtverec ["fotak"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/8.png", true), -- Čtverec ["posta"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/6.png", true), -- Obdélník ["kalendar"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/2.png", true), -- Obdélník ["kufr"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/3.png", true), -- Obdélník ["statistika"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/11.png", true), -- Obdélník ["cas"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/10.png", true), -- Obdélník ["zpet"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/4.png", true), -- Obdélník } guiSetEnabled (ikony["cas"], false ) guiSetEnabled (ikony["kalendar"], false ) local labely = { ["cas"] = guiCreateLabel(0.657, 0.13, 0.27, 0.19, "", true), ["datum"] = guiCreateLabel(0.37, 0.53, 0.27, 0.09, "", true), ["rok"] = guiCreateLabel(0.365, 0.62, 0.27, 0.09, "2013", true), } font = guiCreateFont( "casik.ttf", 100 ) guiSetFont( labely["cas"], font ) guiLabelSetHorizontalAlign(labely["cas"], "center", false) guiLabelSetVerticalAlign(labely["cas"], "center") font2 = guiCreateFont( "cas.ttf", 50 ) guiSetFont( labely["datum"], font2 ) guiLabelSetHorizontalAlign(labely["datum"], "center", false) guiLabelSetVerticalAlign(labely["datum"], "center") font3 = guiCreateFont( "cas.ttf", 60 ) guiSetFont( labely["rok"], font3 ) guiLabelSetHorizontalAlign(labely["rok"], "center", false) guiLabelSetVerticalAlign(labely["rok"], "center") -- Alphy -- guiSetAlpha ( ikony["pohar"], 0.75 ) guiSetAlpha ( ikony["ovladac"], 0.75 ) guiSetAlpha ( ikony["sluchatka"], 0.75 ) guiSetAlpha ( ikony["taska"], 0.75 ) guiSetAlpha ( ikony["fotak"], 0.75 ) guiSetAlpha ( ikony["posta"], 0.75 ) guiSetAlpha ( ikony["kalendar"], 1 ) guiSetAlpha ( ikony["kufr"], 0.75 ) guiSetAlpha ( ikony["statistika"], 0.75 ) guiSetAlpha ( ikony["cas"], 1 ) guiSetAlpha ( ikony["zpet"], 0.75 ) for _, gui in pairs ( ikony ) do guiSetVisible ( gui, false ) end for _, gui in pairs ( labely ) do guiSetVisible ( gui, false ) end -- Alphy -- addEventHandler ( "onClientMouseEnter", root, function ( aX, aY ) for _, gui in pairs ( ikony ) do if ( gui == source ) then guiSetAlpha ( source, 1 ) break end end end ) addEventHandler ( "onClientMouseLeave", root, function ( aX, aY ) for _, gui in pairs ( ikony ) do if ( gui == source ) then guiSetAlpha ( source, 0.75 ) break end end end ) local visible = false bindKey ("U", "down", function ( ) visible = ( not visible ) showCursor ( false ) for _, gui in pairs ( ikony ) do guiSetVisible ( gui, visible ) end for _, gui in pairs ( labely ) do guiSetVisible ( gui, visible ) end if ( visible ) then showCursor ( true ) local realTime = getRealTime ( ) local rTime = string.format ( "%02d:%02d", realTime.hour, realTime.minute) local realDate = getRealTime ( ) local rDate = string.format ( "%02d/%d", realDate.monthday, realDate.month+1) guiSetText ( labely["cas"], rTime ) guiSetText ( labely["datum"], rDate ) end end ) function zpet () addEventHandler ( "onClientGUIClick", ikony["zpet"], zpet2, false ) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), zpet ) function zpet2(button) if button == "left" then showCursor ( false ) for _, gui in pairs ( ikony ) do guiSetVisible ( gui, not visible ) end for _, gui in pairs ( labely ) do guiSetVisible ( gui, not visible ) end end end When i click to button ikony["zpet"] i must then press 2x U to open it again, but why? Where's problem? Link to comment
Castillo Posted July 23, 2013 Share Posted July 23, 2013 You must set the 'visible' variable. Link to comment
Jaysds1 Posted July 23, 2013 Share Posted July 23, 2013 Didn't I already fixed this in another topic? viewtopic.php?f=91&t=62595 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now