papam77 Posted July 22, 2013 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?
Castillo Posted July 22, 2013 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author Posted July 22, 2013 And how can do in string.format type HH/MM ?
Vector Posted July 22, 2013 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 there are two kinds of people: those who know C++ and those who don´t. .)
Castillo Posted July 22, 2013 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author 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?
Castillo Posted July 22, 2013 Posted July 22, 2013 Does the script output any kind of error at the debugscript? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author 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)
Castillo Posted July 22, 2013 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Vector Posted July 22, 2013 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 ) there are two kinds of people: those who know C++ and those who don´t. .)
Vector Posted July 22, 2013 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) there are two kinds of people: those who know C++ and those who don´t. .)
50p Posted July 22, 2013 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. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
papam77 Posted July 22, 2013 Author Posted July 22, 2013 Solidsnake, for key, gui in pairs ( ikony ) do This works, but it is works only for one image called ["kufr"]
Castillo Posted July 22, 2013 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? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author 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"]
Castillo Posted July 22, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author 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?
Castillo Posted July 22, 2013 Posted July 22, 2013 I don't get what do you mean. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted July 22, 2013 Posted July 22, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author 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..
Castillo Posted July 22, 2013 Posted July 22, 2013 Loop it the same way as for over-effect, but instead of set alpha, hide it. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted July 22, 2013 Posted July 22, 2013 for _, gui in pairs ( ikony ) do guiSetVisible ( gui, false ) end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
papam77 Posted July 22, 2013 Author 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.
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