Jump to content

Real Time


Recommended Posts

Client side

local nX, nY = guiGetScreenSize( ) 
  
addEventHandler( 'onClientRender', root,  
    function( )  
        dxDrawText( string.format( '%s %s', getRealTime( ).hour, getRealTime( ).minute ), 0.9 * nX, 0.1 * nY ) 
    end 
) 

?

Updated.

Link to comment

I know how to make it...What I want to know is which way will be better ( better = optimized) for checking the time.

PD : I'm using label.

  
  
  
tiempoRealLabel = guiCreateLabel(0.8525,0.0430,0.1152,0.0559,"Tiempo",true) 
guiSetFont(tiempoRealLabel,arialBoldFont) 
  
function enCalcularTiempoPayDay() 
  
local tiempoTabla = getRealTime() 
local minutos = tiempoTabla.minute 
local horas = tiempoTabla.hour 
guiSetText(tiempoRealLabel,tostring(horas).." : "..tostring(minutos)) 
    if minutos == 0 then 
    triggerServerEvent("onPayDay",localPlayer,minutos,horas) 
    outputClient("PAY DAY",0,200,50) 
    end 
end 
addEventHandler("onClientRender",root,enCalcularTiempoPayDay) 
  
  

Link to comment

Yea, my bad...can't use trigger for a render Event.

  
  
tiempoRealLabel = guiCreateLabel(0.8525,0.0430,0.1152,0.0559,"Tiempo",true) 
guiSetFont(tiempoRealLabel,arialBoldFont) 
  
setTimer( function() 
  
local tiempoTabla = getRealTime() 
local minutos = tiempoTabla.minute 
local horas = tiempoTabla.hour 
guiSetText(tiempoRealLabel,tostring(horas).." : "..tostring(minutos)) 
    if minutos == 0 then 
    triggerServerEvent("onPayDay",localPlayer,minutos,horas) 
    outputClient("PAY DAY",0,200,50) 
    end 
end 
,5000,0) -- How much seconds of delay?, I switch to five but perhaps can be more 
  
  

Link to comment

https://wiki.multitheftauto.com/wiki/Sta ... Font_Names

tiempoRealLabel =   guiCreateLabel(0.8525,0.0430,0.1152,0.0559,"Tiempo",true) 
                    guiSetFont ( tiempoRealLabel, "default-bold-small" ) 
setTimer( 
function( ) 
    local tiempoTabla = getRealTime(getLoclPlayer) 
    local minutos = tiempoTabla.minute 
    local horas = tiempoTabla.hour 
    guiSetText(tiempoRealLabel, tostring(horas).." : "..tostring(minutos)) 
    if minutos == 0 then 
    triggerServerEvent("onPayDay", getLoclPlayer, minutos, horas ) 
    outputClient("PAY DAY", 0, 200, 50 ) 
    end 
end, 50, 0 ) 

Link to comment
https://wiki.multitheftauto.com/wiki/Standard_GUI_Font_Names
tiempoRealLabel =   guiCreateLabel(0.8525,0.0430,0.1152,0.0559,"Tiempo",true) 
                    guiSetFont ( tiempoRealLabel, "default-bold-small" ) 
setTimer( 
function( ) 
    local tiempoTabla = getRealTime(getLoclPlayer) 
    local minutos = tiempoTabla.minute 
    local horas = tiempoTabla.hour 
    guiSetText(tiempoRealLabel, tostring(horas).." : "..tostring(minutos)) 
    if minutos == 0 then 
    triggerServerEvent("onPayDay", getLoclPlayer, minutos, horas ) 
    outputClient("PAY DAY", 0, 200, 50 ) 
    end 
end, 50, 0 ) 

what is outputClient ? °_°

It's

outputChatBox("PAY DAY", 0, 200, 50 ) 

another one

    local tiempoTabla = getRealTime(localPlayer) 

Edited by Guest
Link to comment
https://wiki.multitheftauto.com/wiki/Standard_GUI_Font_Names
tiempoRealLabel =   guiCreateLabel(0.8525,0.0430,0.1152,0.0559,"Tiempo",true) 
                    guiSetFont ( tiempoRealLabel, "default-bold-small" ) 
setTimer( 
function( ) 
    local tiempoTabla = getRealTime(getLoclPlayer) 
    local minutos = tiempoTabla.minute 
    local horas = tiempoTabla.hour 
    guiSetText(tiempoRealLabel, tostring(horas).." : "..tostring(minutos)) 
    if minutos == 0 then 
    triggerServerEvent("onPayDay", getLoclPlayer, minutos, horas ) 
    outputClient("PAY DAY", 0, 200, 50 ) 
    end 
end, 50, 0 ) 

what is outputClient ? °_°

It's

outputChatBox("PAY DAY", 0, 200, 50 ) 

I do not know

But I agree with you that this error

Link to comment

ok, try this:

tiempoRealLabel = guiCreateLabel(0.8525,0.0430,0.1152,0.0559,"Tiempo",true) 
guiSetFont(tiempoRealLabel,arialBoldFont) 
  
setTimer(function() 
    local tiempoTabla = getRealTime() 
    local minutos = tiempoTabla.minute 
    local horas = tiempoTabla.hour 
    guiSetText(tiempoRealLabel,tostring(horas).." : "..tostring(minutos)) 
    if minutos == 00 then 
        triggerServerEvent("onPayDay",localPlayer,minutos,horas) 
        outputChatBox("PAY DAY",0,200,50) 
    end 
end,5000,0) -- How much seconds of delay?, I switch to five but perhaps can be more 

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