Advertisement
Bolodefchoco_LUAXML

[Script] Mega-Sena

Apr 3rd, 2016
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 03/04/2016
  3. --Last update: 26/05/2016
  4. --[[ Notes:
  5.     Does:
  6.         Cria um sorteio de 3 números.
  7.     Commands
  8.         !
  9.             start --> Inicia um novo sorteio
  10.                 q --> Caso exista, o sorteio será feito de 1 a q, caso contrário, 1 a 20
  11. ]]--
  12.  
  13. adm={Bolodefchoco=true,Ruamorangos=true} --< Troque Bolodefchoco ou Ruamorangos e ponha seu nome no local
  14.  
  15. math.randomseed(os.time())
  16. table.destroy=function(t,k)
  17.     for i,v in pairs (t) do
  18.         if k==v then
  19.             table.remove(t,i)
  20.             break
  21.         end
  22.     end
  23. end
  24. table.random=function(t)
  25.     return (type(t)=="table" and t[math.random(#t)] or math.random())
  26. end
  27. eventChatCommand=function(n,c)
  28.     if c:sub(1,5)=="start" and adm[n] then
  29.         _G["lim"] = c:sub(7)~="" and tonumber(c:sub(7)) or 20
  30.         time=os.time()+6000
  31.     end
  32. end
  33. eventLoop=function()
  34.     if time and os.time()<time then
  35.         local numbers={}
  36.         local sortN={}
  37.         for i = 1,lim do
  38.             table.insert(numbers,i)
  39.         end
  40.         for i = 1,3 do
  41.             local randomNumber=table.random(numbers)
  42.             table.destroy(numbers,randomNumber)
  43.             table.insert(sortN,randomNumber)
  44.         end
  45.         table.sort(sortN,function(a,b) return a<b end)
  46.         for i = 1,3 do
  47.             ui.addTextArea(i,"<font size='20'>"..table.random({"<PT>","<BV>","<R>","<J>","<ROSE>"})..("%02d"):format(sortN[i]),nil,(40*i)+305,360)
  48.         end
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement