papam77 Posted July 22, 2013 Share Posted July 22, 2013 Time: local labely = { ["cas"] = guiCreateLabel(0.637, 0.13, 0.27, 0.19, ""..hours..":"..minutes, true), } But here is problem when is time 18:05 it shows only 18:5 i need it with 0 so 18:05, how can do it? And next ask. How can getLocalDate? Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 The function getRealTime client side, returns the local player's time. And about the "0" thing, you can use string.format Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 And how can do in string.format type HH/MM ? Link to comment
Vector Posted July 22, 2013 Share Posted July 22, 2013 (edited) string.format is like printf in C. function getRealTimeFormatted () local timeInfo = getRealTime (); return string.format ("%d/%d", timeInfo.hour, timeInfo.minute); end; outputChatBox ("Current server time is: " .. getRealTimeFormatted ()); Edited July 22, 2013 by Guest Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 local realTime = getRealTime ( ) local rTime = string.format ( "%02d:%02d:%02d", realTime.hour, realTime.minute, realTime.second ) outputChatBox ( "The time is: ".. rTime ) Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 Thank you, and this. I don't wanna make new thread: ----------------------------- -- Userpanel Design --------- ----------------------------- function design () showCursor (true) local realTime = getRealTime ( ) local rTime = string.format ( "%02d:%02d", realTime.hour, realTime.minute) 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["pohar"], false ) guiSetEnabled ( ikony["ovladac"], false ) guiSetEnabled ( ikony["sluchatka"], false ) guiSetEnabled ( ikony["taska"], false ) guiSetEnabled ( ikony["fotak"], false ) guiSetEnabled ( ikony["posta"], false ) guiSetEnabled ( ikony["kalendar"], false ) guiSetEnabled ( ikony["kurf"], false ) guiSetEnabled ( ikony["statistika"], false ) guiSetEnabled ( ikony["cas"], false ) guiSetEnabled ( ikony["zpet"], false ) local labely = { ["cas"] = guiCreateLabel(0.637, 0.13, 0.27, 0.19, ""..rTime, true), } font = guiCreateFont( "lithos.ttf", 75 ) guiSetFont( labely["cas"], font ) guiLabelSetHorizontalAlign(labely["cas"], "center", false) guiLabelSetVerticalAlign(labely["cas"], "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"], 0.75 ) guiSetAlpha ( ikony["kufr"], 0.75 ) guiSetAlpha ( ikony["statistika"], 0.75 ) guiSetAlpha ( ikony["cas"], 0.75 ) guiSetAlpha ( ikony["zpet"], 0.75 ) -- Alphy -- function pohar() addEventHandler( "onClientMouseEnter", root, function(aX, aY) for key,gui in pairs (ikony["pohar"]) and (ikony["ovladac"]) and (ikony["sluchatka"]) and (ikony["taska"]) and (ikony["fotak"]) and (ikony["posta"]) and (ikony["kalendar"]) and (ikony["statistika"]) and (ikony["cas"]) and (ikony["zpet"]) do if gui == source then guiSetAlpha ( source, 1 ) return end end end ) addEventHandler( "onClientMouseLeave", root, function(aX, aY) for key,gui in pairs (ikony["pohar"]) and (ikony["ovladac"]) and (ikony["sluchatka"]) and (ikony["taska"]) and (ikony["fotak"]) and (ikony["posta"]) and (ikony["kalendar"]) and (ikony["statistika"]) and (ikony["cas"]) and (ikony["zpet"]) do if gui == source then guiSetAlpha ( source, 0.75 ) return end end end ) addEventHandler ( "onClientGUIClick", ikony["pohar"], btn2, false ) end function btn2(button) if button == "left" then outputChatBox ("xaxax") end end addCommandHandler ("up", pohar ) end addCommandHandler ("up", design ) Why it doesn't setting alpha 1 for images which are added in code? Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 Does the script output any kind of error at the debugscript? Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 ERROR: userpanel/client.lua:66: bad argument #1 to 'pairs' (table expected, got userdata) ERROR: userpanel/client.lua:77: bad argument #1 to 'pairs' (table expected, got userdata) Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 That's because you are trying to loop the elements, not the table. for key,gui in pairs (ikony["pohar"]) and (ikony["ovladac"]) and (ikony["sluchatka"]) and (ikony["taska"]) and (ikony["fotak"]) and (ikony["posta"]) and (ikony["kalendar"]) and (ikony["statistika"]) and (ikony["cas"]) and (ikony["zpet"]) do Should be: for key, gui in pairs ( ikony ) do Link to comment
Vector Posted July 22, 2013 Share Posted July 22, 2013 ----------------------------- -- Userpanel Design --------- ----------------------------- function design () showCursor (true) local realTime = getRealTime ( ) local rTime = string.format ( "%02d:%02d", realTime.hour, realTime.minute) 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 }; -- set alpha & disable static images. for _,gui in pairs (ikony) do guiSetEnabled (gui, false); guiSetAlpha (gui, .75); end; local labely = { ["cas"] = guiCreateLabel(0.637, 0.13, 0.27, 0.19, ""..rTime, true), }; font = guiCreateFont( "lithos.ttf", 75 ) guiSetFont( labely["cas"], font ) guiLabelSetHorizontalAlign(labely["cas"], "center", false) guiLabelSetVerticalAlign(labely["cas"], "center") addEventHandler( "onClientMouseLeave", root, function(aX, aY) for _,gui in pairs (ikony) do if source == gui then guiSetAlpha (source, 1); end; end; end ) addEventHandler ( "onClientGUIClick", ikony["pohar"], btn2, false ) end function btn2(button) if button == "left" then outputChatBox ("xaxax") end end addCommandHandler ("up", pohar ) end addCommandHandler ("up", design ) Link to comment
Vector Posted July 22, 2013 Share Posted July 22, 2013 solidsnake, there is no reason to add %02 cause the range of hours is 0-23 and for minutes is 0-59. wich is < 100 (3 numbers) Link to comment
50p Posted July 22, 2013 Share Posted July 22, 2013 @Vector, Read author's first post. He doesn't want "18:5", he wants "18:05". By formatting string with %02d you get 2 digit number, 05 it it's 5, 10 if it's 10. Also, please edit your posts instead of double posting. Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 Solidsnake, for key, gui in pairs ( ikony ) do This works, but it is works only for one image called ["kufr"] Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 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 ) Is that what you did? Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 Yes, if you want you can try it. http://www.upload.ee/files/3461345/updj.zip.html Or connect to 85.118.131.200:22012 and pass 85219 command for userpanel /up current code: ----------------------------- -- Userpanel Design --------- ----------------------------- function design () 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) 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["pohar"], false ) guiSetEnabled ( ikony["ovladac"], false ) guiSetEnabled ( ikony["sluchatka"], false ) guiSetEnabled ( ikony["taska"], false ) guiSetEnabled ( ikony["fotak"], false ) guiSetEnabled ( ikony["posta"], false ) guiSetEnabled ( ikony["kalendar"], false ) guiSetEnabled ( ikony["kurf"], false ) guiSetEnabled ( ikony["statistika"], false ) guiSetEnabled ( ikony["cas"], false ) guiSetEnabled ( ikony["zpet"], false ) local labely = { ["cas"] = guiCreateLabel(0.637, 0.13, 0.27, 0.19, ""..rTime, true), ["datum"] = guiCreateLabel(0.37, 0.53, 0.27, 0.09, ""..rDate, true), ["rok"] = guiCreateLabel(0.365, 0.62, 0.27, 0.09, "2013", true), } font = guiCreateFont( "cas.ttf", 75 ) 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"], 0.75 ) guiSetAlpha ( ikony["kufr"], 0.75 ) guiSetAlpha ( ikony["statistika"], 0.75 ) guiSetAlpha ( ikony["cas"], 0.75 ) guiSetAlpha ( ikony["zpet"], 0.75 ) -- Alphy -- function pohar() 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 ) addEventHandler ( "onClientGUIClick", ikony["pohar"], btn2, false ) end function btn2(button) if button == "left" then outputChatBox ("xaxax") end end addCommandHandler ("up", pohar ) end addCommandHandler ("up", design ) And it is setting alpha to 1 only for ["kufr"] Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 That's because all the other images are disabled by guiSetEnabled, and this one "kufr" is not because you made a typo when disabling it at line 35. ----------------------------- -- Userpanel Design --------- ----------------------------- function design () 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) 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["pohar"], false ) guiSetEnabled ( ikony["ovladac"], false ) guiSetEnabled ( ikony["sluchatka"], false ) guiSetEnabled ( ikony["taska"], false ) guiSetEnabled ( ikony["fotak"], false ) guiSetEnabled ( ikony["posta"], false ) guiSetEnabled ( ikony["kalendar"], false ) guiSetEnabled ( ikony["kufr"], false ) guiSetEnabled ( ikony["statistika"], false ) guiSetEnabled ( ikony["cas"], false ) guiSetEnabled ( ikony["zpet"], false ) local labely = { ["cas"] = guiCreateLabel(0.637, 0.13, 0.27, 0.19, ""..rTime, true), ["datum"] = guiCreateLabel(0.37, 0.53, 0.27, 0.09, ""..rDate, true), ["rok"] = guiCreateLabel(0.365, 0.62, 0.27, 0.09, "2013", true), } font = guiCreateFont( "cas.ttf", 75 ) 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"], 0.75 ) guiSetAlpha ( ikony["kufr"], 0.75 ) guiSetAlpha ( ikony["statistika"], 0.75 ) guiSetAlpha ( ikony["cas"], 0.75 ) guiSetAlpha ( ikony["zpet"], 0.75 ) -- Alphy -- function pohar() 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 ) addEventHandler ( "onClientGUIClick", ikony["pohar"], btn2, false ) end function btn2(button) if button == "left" then outputChatBox ("xaxax") end end addCommandHandler ("up", pohar ) end addCommandHandler ("up", design ) With that code, none will work now, you can't do the over-effect if the images are disabled. Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 ----------------------------- -- Userpanel Design --------- ----------------------------- function design () 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) 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 } local labely = { ["cas"] = guiCreateLabel(0.637, 0.13, 0.27, 0.19, ""..rTime, true), ["datum"] = guiCreateLabel(0.37, 0.53, 0.27, 0.09, ""..rDate, true), ["rok"] = guiCreateLabel(0.365, 0.62, 0.27, 0.09, "2013", true), } font = guiCreateFont( "cas.ttf", 75 ) 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"], 0.75 ) guiSetAlpha ( ikony["kufr"], 0.75 ) guiSetAlpha ( ikony["statistika"], 0.75 ) guiSetAlpha ( ikony["cas"], 0.75 ) guiSetAlpha ( ikony["zpet"], 0.75 ) -- Alphy -- function pohar() 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 ) addEventHandler ( "onClientGUIClick", ikony["pohar"], btn2, false ) end function btn2(button) if button == "left" then outputChatBox ("xaxax") end end addCommandHandler ("up", pohar ) end addCommandHandler ("up", design ) I've fixed it, but here is problem when i hit ["cas"] label then button lost alpha because label is on button, how can do it when i hit label it will still works for button? Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 I don't get what do you mean. Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 And this please i've forgoten ----------------------------- -- Userpanel Design --------- ----------------------------- bindKey ("U", "up", function () 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) 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.637, 0.13, 0.27, 0.19, ""..rTime, true), ["datum"] = guiCreateLabel(0.37, 0.53, 0.27, 0.09, ""..rDate, true), ["rok"] = guiCreateLabel(0.365, 0.62, 0.27, 0.09, "2013", true), } font = guiCreateFont( "cas.ttf", 75 ) 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 ) -- 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 ) end ) bindKey("U", "down", function () if (ikony) and (labely) then destroyElement(ikony) destroyElement(labely) end end) How can hide all, because this doesn't work.. Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 Loop it the same way as for over-effect, but instead of set alpha, hide it. Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 How you mean it, i don't understand. Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 for _, gui in pairs ( ikony ) do guiSetVisible ( gui, false ) end Link to comment
papam77 Posted July 22, 2013 Author Share Posted July 22, 2013 ----------------------------- -- Userpanel Design --------- ----------------------------- bindKey ("U", "up", function () 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) 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.637, 0.13, 0.27, 0.19, ""..rTime, true), ["datum"] = guiCreateLabel(0.37, 0.53, 0.27, 0.09, ""..rDate, true), ["rok"] = guiCreateLabel(0.365, 0.62, 0.27, 0.09, "2013", true), } font = guiCreateFont( "cas.ttf", 75 ) 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 ) -- 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 ) end ) bindKey("U", "down", function () for _, gui in pairs ( ikony ) and ( labely ) do guiSetVisible ( gui, false ) end end) Now i have this, but it makes it again. 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