231 Posted July 25, 2019 Posted July 25, 2019 كان من الممكن أن أفعل ذلك بشكل خاطئ حيث لا يمكنني إحضاره بطريقة ما لا تزال مناسبة local sx, sy = guiGetScreenSize() function renderText() dxDrawText(timeText, sx/2, sy/2, 0, 0, tocolor(255, 255, 255), 2, "default-bold") end function countdownFin() --whatever you want to happen here end local countdown = setTimer(countdownFin, 600000, 1) --set the timer for 10 minutes setTimer( function() local x = getTimerDetails(countdown) local timeLeft = math.ceil(x/1000) outputChatBox(convertSecondsToMinutes(timeLeft)) end, 1000, 0) function convertSecondsToMinutes(sec) --turn the seconds into a MM:SS format local temp = sec/60 local temp2 = (math.floor(temp)) --this equals the minutes local temp3 = sec-(temp2*60) --and this is seconds if string.len(temp3) < 2 then --make sure it's displayed correctly (MM:SS) temp3 = "0"..tostring(temp3) end return tostring(temp2)..":"..tostring(temp3) end النص هو اقتباس
Hakan Posted July 25, 2019 Posted July 25, 2019 local sx,sy = guiGetScreenSize ( ) ; addEventHandler ( "onClientRender" , root , function ( ) if ( isTimer ( countdown ) ) then local seconds = math.floor ( getTimerDetails ( countdown ) / 1000 ) ; dxDrawText ( tostring ( seconds ) , 0 , 0 , sx , sy , tocolor ( 255 , 255 , 255 , 200 ) , 2 , "default-bold" , "center","center" ) end end ) جرب هذا الكود بشرط ان التايمر يكون بجانب الكلنت واسم التايمر countdown
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