Edikosh998 Posted May 7, 2012 Share Posted May 7, 2012 So, I decided to make a label with the real time. However, I don't know what's better...with "onClientRender", or with a timer of 60000 ms delay ? Link to comment
Kenix Posted May 7, 2012 Share Posted May 7, 2012 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
Edikosh998 Posted May 7, 2012 Author Share Posted May 7, 2012 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
Edikosh998 Posted May 7, 2012 Author Share Posted May 7, 2012 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
abu5lf Posted May 7, 2012 Share Posted May 7, 2012 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
Jaysds1 Posted May 8, 2012 Share Posted May 8, 2012 (edited) 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 May 8, 2012 by Guest Link to comment
abu5lf Posted May 8, 2012 Share Posted May 8, 2012 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
Jaysds1 Posted May 8, 2012 Share Posted May 8, 2012 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
Edikosh998 Posted May 8, 2012 Author Share Posted May 8, 2012 a) Is a exported Font.. ARIALBOLD.TFF b) outputClient is the GUI Messages's resource... Is working good, I was just asking if there is better to put the timer with less or more delay... viewtopic.php?f=108&t=42340 Link to comment
Jaysds1 Posted May 8, 2012 Share Posted May 8, 2012 oh, ok, Since you have trigger server event then you have to use setTimer. Link to comment
Edikosh998 Posted May 8, 2012 Author Share Posted May 8, 2012 oh, ok,Since you have trigger server event then you have to use setTimer. Yea, i've realised of that...Is like triggering an event 100 times Link to comment
Jaysds1 Posted May 8, 2012 Share Posted May 8, 2012 true, so, you've got your question solved am I right? Link to comment
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