Jump to content

Add Date and year


Recommended Posts

Hello, I would be grateful if someone could help me add date and actual year in this script.

I am very out of time and can not, lose much time. if someone really help me. I know that is not long for this type of resource.

local rootElement = getRootElement() 
local sw,sh = guiGetScreenSize() 
  
local windowW = 280 
local windowH = 160 
  
local windowTitle        = "" 
local windowTitleHeight  = 40 
local windowTitleColor   = tocolor(0,0,0,255) 
local windowTitleBGColor = tocolor(0,0,0,255) 
local windowBGColor      = tocolor(0,0,0,0) 
  
local windowX = sw - 350 - windowW 
local windowY = sh / 1.08 - windowH / 2 
  
local localPlayer = getLocalPlayer ( ) 
  
function dx (thePlayer) 
local ping = getPlayerPing(getLocalPlayer()) 
local time      = getRealTime() 
    local hours     = time.hour 
    local minutes   = time.minute 
    local seconds   = time.second 
    local day       = time.monthday 
    local weekday   = time.weekday 
    local month     = time.month 
    local year      = time.year 
  
local playerName = getPlayerName ( getLocalPlayer() ) 
local money = getPlayerMoney(thePlayer) 
local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) 
local playerZoneName =  getZoneName( playerX, playerY, playerZ ) 
local health = getElementHealth(getLocalPlayer()) 
  
        dxDrawText(""..hours..": "..minutes..": "..seconds.." ",sw/60.203, sh/1.500, sw,sh,tocolor(255,255,255,255),1.5,"default","left","top",false,false,false) 
        dxDrawColorText(""..hours.."#FF00CC: #ffffff"..minutes.."#FF00CC: #ffffff"..seconds.." ",sw/60.200, sh/1.505, sw,sh,tocolor(255,255,255,255),1.5,"default","left","top",false,false,false) 
         
    local x = windowX 
    local y = windowY + windowTitleHeight 
    local h = windowH - windowTitleHeight 
  
    dxDrawRectangle(x,y,windowW,h,windowBGColor)     
     
local veh = getPedOccupiedVehicle(localPlayer) 
if veh then 
local vehicle = getVehicleName(veh,thePlayer)        
    else 
    end 
end 
function HandleTheRendering () 
addEventHandler("onClientRender",rootElement, dx) 
end 
addEventHandler("onClientResourceStart",rootElement, HandleTheRendering) 
  

Very Thanks,

Gustavo.

Link to comment

Try this:

local rootElement = getRootElement() 
local sw,sh = guiGetScreenSize() 
  
local windowW = 280 
local windowH = 160 
  
local windowTitle        = "" 
local windowTitleHeight  = 40 
local windowTitleColor   = tocolor(0,0,0,255) 
local windowTitleBGColor = tocolor(0,0,0,255) 
local windowBGColor      = tocolor(0,0,0,0) 
  
local windowX = sw - 350 - windowW 
local windowY = sh / 1.08 - windowH / 2 
  
local localPlayer = getLocalPlayer ( ) 
  
function dx (thePlayer) 
local ping = getPlayerPing(getLocalPlayer()) 
local time      = getRealTime() 
    local hours     = time.hour 
    local minutes   = time.minute 
    local seconds   = time.second 
    local day       = time.monthday 
    local weekday   = time.weekday 
    local month     = time.month+1 
    local year      = time.year+1900 
  
local playerName = getPlayerName ( getLocalPlayer() ) 
local money = getPlayerMoney(thePlayer) 
local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) 
local playerZoneName =  getZoneName( playerX, playerY, playerZ ) 
local health = getElementHealth(getLocalPlayer()) 
  
    dxDrawText(day.."/ "..month.."/ "..year.." ",sw/60.203, sh/1.500, sw,sh,tocolor(0,0,0,255),1.3,"default","left","top",false,false,false) 
    dxDrawText(day.."#FF00CC/ #ffffff"..month.."#FF00CC/ #ffffff"..year.." ",sw/60.200, sh/1.505, sw,sh,tocolor(255,255,255,255),1.3,"default","left","top",false,false,false,true) 
  
    dxDrawText(hours..": "..minutes..": "..seconds.." ",sw/60.203, sh/1.600, sw,sh,tocolor(0,0,0,255),1.5,"default","left","top",false,false,false) 
    dxDrawText(hours.."#FF00CC: #ffffff"..minutes.."#FF00CC: #ffffff"..seconds.." ",sw/60.200, sh/1.605, sw,sh,tocolor(255,255,255,255),1.5,"default","left","top",false,false,false,true) 
        
    local x = windowX 
    local y = windowY + windowTitleHeight 
    local h = windowH - windowTitleHeight 
  
    dxDrawRectangle(x,y,windowW,h,windowBGColor)    
    
local veh = getPedOccupiedVehicle(localPlayer) 
if veh then 
local vehicle = getVehicleName(veh,thePlayer)       
    else 
    end 
end 
function HandleTheRendering () 
addEventHandler("onClientRender",rootElement, dx) 
end 
addEventHandler("onClientResourceStart",rootElement, HandleTheRendering) 
  

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