Advertisement
Bolodefchoco_LUAXML

[Script] Wesley Safadão

Dec 8th, 2015
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 08/12/2015
  3. --Last update: 22/05/2016
  4. --[[ Notes:
  5.     Does:
  6.         Mostra quantos % de anjo e de vagabundo você tem de acordo com a data de nascimento.
  7.     Args:
  8.         day --> Caso seja número, deverá ser DD do dia de nascimento, caso seja string, deverá ser "DD/MM/AAAA"
  9.         month --> Caso day seja número, deverá ser MM do mês de nascimento.
  10.         year --> Caso day seja número, deverá ser AAAA do ano de nascimento.
  11.     Desafio:
  12.         http://s2.glbimg.com/Hm5CL7z8G9WyqANaJnCDGeC88LI=/s.glbimg.com/jo/g1/f/original/2015/12/07/safadao_questao_materia.jpg
  13. ]]--
  14.  
  15. somatorio=function(x)
  16.     if x == 0 then return 0 end
  17.     return x + somatorio(x-1)
  18. end
  19.  
  20. wesley_safadao=function(day,month,year)
  21.     if type(day) == "string" then
  22.         day,month,year = day:match("(%d+)/(%d+)/(%d+)")
  23.         if not day or not month or not year then error("Data inválida") end
  24.         if #year > 2 then year=year:sub(3) end
  25.     end
  26.     day,month,year = tonumber(day),tonumber(month),#tostring(year) > 2 and tonumber(tostring(year):sub(3)) or tonumber(year)
  27.     local anjo,vagabundo = 0,0
  28.     if day == 6 and month == 9 and year == 96 then
  29.         anjo,vagabundo = 99,1
  30.     else
  31.         vagabundo = somatorio(month)+(year/100)*(50-day)
  32.         anjo = 100-vagabundo
  33.     end
  34.     if vagabundo+anjo == 100 and vagabundo>0 and vagabundo<100 and anjo>0 and anjo<100 then
  35.         print("\nAnjo: "..anjo.."%\nVagabundo: "..vagabundo.."%\n\n\"[...] Tô namorando todo mundo, "..anjo.."% anjo, perfeito\nMas aquele "..vagabundo.."% é vagabundo\nMas aquele "..vagabundo.."% é vagabundo\nSafado e elas gostam.. [...]\"")
  36.     else
  37.         error("Erro de calculo")
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement