Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local server = "http://82.235.168.183/time.php"
- function getWorldTime()
- return os.time()
- end
- function getWorldTick()
- worldTick = (os.time() * 1000 + 18000) % 24000
- return worldTick
- end
- function getWorldDay()
- return os.day()
- end
- function canPlayerGotoBed()
- time = getWorldTick()
- if time > 12541 and time < 23458 then
- return true
- else
- return false
- end
- end
- function canPlayerSleep()
- time = getWorldTick()
- if time > 12541 and time < 23458 then
- return true
- else
- return false
- end
- end
- function isWorldDay()
- time = getWorldTick()
- if time > 0 and time < 12000 then
- return true
- else
- return false
- end
- end
- function isWorldNight()
- time = getWorldTick()
- if time > 13501 and time < 23000 then
- return true
- else
- return false
- end
- end
- function isWorldDusk()
- time = getWorldTick()
- if time > 12001 and time < 13500 then
- return true
- else
- return false
- end
- end
- function isWorldDawn()
- time = getWorldTick()
- if time > 23001 and time < 23999 then
- return true
- else
- return false
- end
- end
- function canMobsSpawn()
- time = getWorldTick()
- if time > 13187 and time < 22812 then
- return true
- else
- return false
- end
- end
- function canMobsBurn()
- time = getWorldTick()
- if time > 23459 or time < 12650 then
- return true
- else
- return false
- end
- end
- function getWorldElapsedSeconds()
- time = getWorldTick() / 1000
- elapsed = time * 50
- return elapsed
- end
- function getWorldHours()
- time = getWorldTick()
- hours = time / 1000 + 6
- if hours > 23 then
- hoursStr = tonumber(math.floor(hours - 24))
- hoursStr = "0"..hoursStr
- elseif hours < 10 then
- hoursStr = tonumber(math.floor(hours))
- hoursStr = "0"..hoursStr
- else
- hoursStr = tonumber(math.floor(hours))
- end
- if hoursStr == "0-1" then
- hoursStr = "23"
- end
- return hoursStr
- end
- function getWorldMinutes()
- time = getWorldTick()
- minutes = (time % 1000) * 60 / 1000
- minutesStr = tonumber(math.floor(minutes))
- if minutes < 10 then
- minutesStr = "0"..minutesStr
- end
- return minutesStr
- end
- function getRealMinutes()
- response = http.get(server.."?req=minutes")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealHours()
- response = http.get(server.."?req=hours")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealSeconds()
- response = http.get(server.."?req=seconds")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealWeekDay()
- response = http.get(server.."?req=wday")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealMonthDay()
- response = http.get(server.."?req=mday")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealYear()
- response = http.get(server.."?req=year")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealYearDay()
- response = http.get(server.."?req=yday")
- text = response.readAll()
- response.close()
- return text
- end
- function getRealMonth()
- response = http.get(server.."?req=mon")
- text = response.readAll()
- response.close()
- return text
- end
- function getWorldComplete(sep)
- if sep then
- return getWorldHours()..sep..getWorldMinutes()
- else
- return getWorldHours()..":"..getWorldMinutes()
- end
- end
- function getRealComplete(sep, secs, sepSec)
- if not sep then
- sep = ":"
- end
- if not sepSec then
- sepSec = "."
- end
- if secs then
- return getRealHours()..sep..getRealMinutes()..sepSec..getRealSeconds()
- else
- return getRealHours()..sep..getRealMinutes()
- end
- end
- function getWorldYear()
- year = os.day() / 360
- return math.floor(year)
- end
- function getWorldWeekDay()
- tablewday = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
- wday = os.day() % 7
- return tablewday[wday + 1]
- end
- function getWorldMonth()
- tablemonth = {"January", "February", "March", "April", "May", "June", "July", "August", "Spetember", "October", "November", "December"}
- month = os.day() / 30
- month = month % 12
- return tablemonth[math.floor(month + 1)]
- end
- function getWorldDate()
- date = os.day() % 30
- return date + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement