#Paper Posted January 13, 2011 Share Posted January 13, 2011 How i can convert the time in the hunter alert (in toptimes ) to a real time? Hunter TopTimes: -M$P-SuN got TopTime Position! | Rank: 1 | Time: 199507 The "Time" field isn't the time, is random numbers... how i can get the time? Link to comment
SDK Posted January 13, 2011 Share Posted January 13, 2011 It's not a random number, it's the amount of time in milliseconds: 199507 milliseconds = 3*60*1000 + 19 * 1000 + 507 = 3 minutes + 19 seconds + 507 milliseconds this function comes from race_toptimes: function msToTimeStr(ms) if not ms then return '' end local centiseconds = tostring(math.floor(math.fmod(ms, 1000)/10)) if #centiseconds == 1 then centiseconds = '0' .. centiseconds end local s = math.floor(ms / 1000) local seconds = tostring(math.fmod(s, 60)) if #seconds == 1 then seconds = '0' .. seconds end local minutes = tostring(math.floor(s / 60)) return minutes .. ':' .. seconds .. ':' .. centiseconds end Link to comment
#Paper Posted January 13, 2011 Author Share Posted January 13, 2011 So, i've that function, how to get the time? outputChatBox("Hunter TopTimes: "..getPlayerName(source).. ' got TopTime Position! | Rank: ' .. newPos .. " | Time:"..tostring(newTime)) end Link to comment
SDK Posted January 13, 2011 Share Posted January 13, 2011 outputChatBox("Hunter TopTimes: "..getPlayerName(source).. ' got TopTime Position! | Rank: ' .. newPos .. " | Time:"..msToTimeStr(newTime)) Link to comment
#Paper Posted January 14, 2011 Author Share Posted January 14, 2011 outputChatBox("Hunter TopTimes: "..getPlayerName(source).. ' got TopTime Position! | Rank: ' .. newPos .. " | Time:"..msToTimeStr(newTime)) lol simple Thanks! ;D 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