freudo Posted November 1, 2020 Posted November 1, 2020 local currentTime = getRealTime() local second = 59 -- example data local timeleft = 60-(currentTime.second-second) outputChatBox("Time left : "..math.floor((timeleft/60)/24)..":"..(60-math.floor(timeleft/60))..":"..timeleft) output : 0:60:70 must be : 23:59:59 cannot be calculated correctly. I think the linux server is also a problem. I couldn't solve the problem so i need help. Thanks. WOC-DD Destruction Derby -Level system -Clan system -Topwins -Event system for EXP -Podium with animation And more
Tekken Posted November 1, 2020 Posted November 1, 2020 Have you took a look at the getRealTime page on the wiki? https://wiki.multitheftauto.com/wiki/GetRealTime also can you please explain what are you trying to archive? Resources I made: attachToBones - A newer bone_attach. Simple Level system - Just a simple level system. Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!
freudo Posted November 1, 2020 Author Posted November 1, 2020 I'm trying to count down from 24 to 1. WOC-DD Destruction Derby -Level system -Clan system -Topwins -Event system for EXP -Podium with animation And more
Moderators IIYAMA Posted November 1, 2020 Moderators Posted November 1, 2020 (edited) 16 minutes ago, freudo said: I'm trying to count down from 24 to 1. Use timestamp: local currentTime = getRealTime().timestamp Since the index seconds is only from 0 > 59. Edited November 1, 2020 by IIYAMA Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
freudo Posted November 1, 2020 Author Posted November 1, 2020 (edited) currentTime = 1604249518 dataTime = 1604249510 timeleft = 60-(currentTime-dataTime) hours = math.floor((timeleft/60)/24) minutes = (60-math.floor(timeleft/60)) print("Time left : "..tostring(hours)..":"..minutes..":"..timeleft) output : Time left : 0:60:8 Thanks guys, I solved This works. currentTime = 1604230289602 dataTime = 1603230289602 print(currentTime - dataTime) timeleft = math.floor((currentTime-dataTime)/1000) minutes = math.floor(timeleft/60) hours = math.floor(minutes/60) days = math.floor(hours/24) minutes = minutes%60 hours = hours%24 print("Time left : "..tostring(days).."gün "..tostring(hours).." saat "..tostring(minutes).." dakika") Edited November 1, 2020 by freudo WOC-DD Destruction Derby -Level system -Clan system -Topwins -Event system for EXP -Podium with animation And more
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