Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 16/01/2016
- --Last update: 25/05/2016
- --[[ Notes:
- Does:
- Descubra sua idade em outros planetas!
- Commands:
- !
- dd/mm/yyyy --> Dia de nascimento / Mês de nascimento / Ano de nascimento
- ]]--
- mice={}
- eventNewPlayer=function(n)
- if not mice[n] then
- mice[n]={
- day=-1,
- month=-1,
- year=-1,
- }
- end
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- age=function(day,month,year)
- if type(day) == "string" then
- day,month,year = day:match("(%d+)/(%d+)/(%d+)")
- end
- day,month,year = tonumber(day),tonumber(month),tonumber(year)
- local cDay,cMonth,cYear = tonumber(os.date("%d")),tonumber(os.date("%m")),tonumber(os.date("%Y"))
- if year <= cYear then
- if month < cMonth then
- return cYear-year
- end
- if month == cMonth then
- if day <= cDay then
- return cYear-year
- else
- return cYear-year-1
- end
- end
- if month > cMonth then
- return cYear-year-1
- end
- end
- return 0
- end
- eventChatCommand=function(n,c)
- local d={}
- for v in c:gmatch('[^/]+') do
- table.insert(d,v)
- end
- mice[n].day,mice[n].month,mice[n].year = tonumber(d[1]),tonumber(d[2]),tonumber(d[3])
- local data = {{"Mercury",0.241},{"Venus",0.615},{"Earth",1},{"Mars",1.881},{"Jupiter",11.86},{"Saturn",29.46},{"Uranus",84.01},{"Neptune",164.8},{"Pluto",248.6}}
- local age = age(mice[n].day,mice[n].month,mice[n].year)
- local text = ""
- for i = 1,#data do
- text = text .. "<J>"..data[i][1].." <BL>- <PT>"..age/data[i][2].." years old\n"
- end
- ui.addTextArea(0,"<font size='22'>You are ...</font>\n"..text,n)
- end
Advertisement
Add Comment
Please, Sign In to add comment