Jump to content

Date and time


papam77

Recommended Posts

Posted

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?

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (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 by Guest

there are two kinds of people: those who know C++ and those who don´t. .)

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

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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?

Posted

Does the script output any kind of error at the debugscript?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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)

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Posted

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

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

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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"]

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
----------------------------- 
-- 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?

Posted

I don't get what do you mean.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

And this please i've forgoten :D

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

Posted

Loop it the same way as for over-effect, but instead of set alpha, hide it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
for _, gui in pairs ( ikony ) do 
    guiSetVisible ( gui, false ) 
end 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

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