Advertisement
Rawoas13

[Script] Mega-Sena

Jan 18th, 2020
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. --Creator: Hass
  2. --Made in: 18/01/2020
  3. --Last update: 18/01/2020
  4. --[[ Notes:
  5.     Does:
  6.         Create a 3-number draw.
  7.     Commands
  8.         !
  9.             start --> Starts a new draw
  10.                 q --> If it exists, the draw will be made from 1 to q, otherwise, 1 to 20
  11. ]]--
  12.  
  13. adm={Hass=true,Wanda=true} --< Change Hass or Wanda and put your name on the spot
  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