Jump to content

Show Time


Mefisto_PL

Recommended Posts

Hi, I have a problem with my script to show time. The script shows the time, but unfortunately that was the only time when the script has been included. For example, the script turned on 21:17 and this time shows me all the time. Please help me.

local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
  
addEventHandler("onClientPreRender", getRootElement(), 
    function() 
        local screenWidth, screenHeight = guiGetScreenSize() 
        dxDrawText(hours..":"..minutes, screenWidth - 1160, 920, screenWidth - 110, 200, tocolor(0, 159, 255, 255), 1.5, "Arial", "center", "top", false, false, false) 
        end 
) 
  

Link to comment
addEventHandler("onClientRender", root, 
    function() 
        local screenWidth, screenHeight = guiGetScreenSize() 
        local time = getRealTime() 
        dxDrawText(time.hour..":"..time.minute, screenWidth - 1160, 920, screenWidth - 110, 200, tocolor(0, 159, 255, 255), 1.5, "Arial", "center", "top", false, false, false) 
        end 
) 
  

Link to comment
local screenWidth, screenHeight = guiGetScreenSize() 
addEventHandler("onClientRender", root, 
    function() 
        local time = getRealTime() 
        dxDrawText(string.format("%02d:%02d", time.hour, time.minute), screenWidth - 1160, 920, screenWidth - 110, 200, tocolor(0, 159, 255, 255), 1.5, "Arial", "center", "top", false, false, false) 
    end 
) 

also you should really fix your positioning (screenWidth - 1160 is not the way, people with 1024 or 800 screen width wont see anything).

if you want it to be on the left side, use positive pixel offset from the left side, which is 0.

same with height. 920 pixels is way too far, for example i run mta at 1280x720, i wont see that. people with 1024x768 resolution also wont see that.

and you'll be amazed how many people play at 800x600.

Link to comment

Okey, but my friend play on 800 x 600 and he can't see this text . Can you help me fix this problem?

///EDIT

I have this code and if anybody can fix this script, to show this panel everybody even those who has a resolution of 800 x 600 etc etc.

Secret 

Edited by Guest
Link to comment

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