Advertisement
Vmena

Automatic JJs [ROBLOX]

Apr 15th, 2020
13,980
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.51 KB | None | 1 0
  1. -- Do some JJs automatically
  2. -- JJ/HJ/PJ system scripted by Vmena
  3. -- ConvertNumToWords & ConvertTo999 functions by Nick Gammon
  4.  
  5. local AmountOfJJs = 30
  6. local TimeBetweenMessages = 2.5 -- must be at least 2.5 to avoid chat limiter
  7.  
  8. local JJtype = "JJ" -- This can be "JJ" Jumping Jacks, "HJ" Hell Jacks, or "PJ" Phonetic Jacks
  9.  
  10. inverse_units = {
  11.     "VIGINTILLION ",     -- 10^63
  12.     "NOVEMDECILLION ",   -- 10^60
  13.     "OCTODECILLION ",    -- 10^57
  14.     "SEPTENDECILLION ",  -- 10^54
  15.     "SECDECILLION ",     -- 10^51
  16.     "QUINDECILLION ",    -- 10^48
  17.     "QUATTUORDECILLION ",-- 10^45
  18.     "TREDECILLION ",     -- 10^42
  19.     "DUODECILLION ",    -- 10^39
  20.     "UNDECILLION ",     -- 10^36
  21.     "DECILLION ",       -- 10^33
  22.     "NONILLION ",       -- 10^30
  23.     "OCTILLION ",       -- 10^27
  24.     "SEPTILLION ",      -- 10^24
  25.     "SEXTILLION ",      -- 10^21
  26.     "QUINTILLION ",     -- 10^18
  27.     "QUADRILLION ",     -- 10^15
  28.     "TRILLION ",        -- 10^12
  29.     "BILLION ",         -- 10^9
  30.     "MILLION ",         -- 10^6
  31.     "THOUSAND ",        -- 10^3
  32. }
  33. inverse_numbers = {
  34.     "ONE ",
  35.     "TWO ",
  36.     "THREE ",
  37.     "FOUR ",
  38.     "FIVE ",
  39.     "SIX ",
  40.     "SEVEN ",
  41.     "EIGHT ",
  42.     "NINE ",
  43.     "TEN ",
  44.     "ELEVEN ",
  45.     "TWELVE ",
  46.     "THIRTEEN ",
  47.     "FOURTEEN ",
  48.     "FIFTEEN ",
  49.     "SIXTEEN ",
  50.     "SEVENTEEN ",
  51.     "EIGHTEEN ",
  52.     "NINETEEN ",
  53.     "TWENTY ",
  54.     [30] = "THIRTY ",
  55.     [40] = "FORTY ",
  56.     [50] = "FIFTY ",
  57.     [60] = "SIXTY ",
  58.     [70] = "SEVENTY ",
  59.     [80] = "EIGHTY ",
  60.     [90] = "NINETY ",
  61. }
  62. phonetics = {
  63.     ["A"] = "ALFA",
  64.     ["B"] = "BRAVO",
  65.     ["C"] = "CHARLIE",
  66.     ["D"] = "DELTA",
  67.     ["E"] = "ECHO",
  68.     ["F"] = "FOXTROT",
  69.     ["G"] = "GOLF",
  70.     ["H"] = "HOTEL",
  71.     ["I"] = "INDIA",
  72.     ["J"] = "JULIETT",
  73.     ["K"] = "KILO",
  74.     ["L"] = "LIMA",
  75.     ["M"] = "MIKE",
  76.     ["N"] = "NOVEMBER",
  77.     ["O"] = "OSCAR",
  78.     ["P"] = "PAPA",
  79.     ["Q"] = "QUEBEC",
  80.     ["R"] = "ROMEO",
  81.     ["S"] = "SIERRA",
  82.     ["T"] = "TANGO",
  83.     ["U"] = "UNIFORM",
  84.     ["V"] = "VICTOR",
  85.     ["W"] = "WHISKEY",
  86.     ["X"] = "X-RAY",
  87.     ["Y"] = "YANKEE",
  88.     ["Z"] = "ZULU",
  89. }
  90.  
  91. function ConvertNumToWords(n)
  92.   local s = tostring(n)
  93.     local c = string.match (s, "%D")
  94.     if c then
  95.         return nil, "Non-numeric digit '" .. c .. "' in number"
  96.     end
  97.     if #s == 0 then
  98.         return nil, "No number supplied"
  99.     elseif #s > 66 then
  100.         return nil, "Number too big to convert to words"
  101.     end
  102.     while #s % 3 > 0 do
  103.         s = "0" .. s
  104.     end
  105.     local result = ""
  106.     local start = #inverse_units - (#s / 3) + 2
  107.  
  108.     for i = start, #inverse_units do
  109.         local group = tonumber(string.sub (s, 1, 3))
  110.     if group > 0 then
  111.         result = result .. ConvertTo999 (group) .. inverse_units [i]
  112.     end
  113.         s = string.sub(s, 4)    
  114.     end
  115.     result = result .. ConvertTo999(tonumber (s))
  116.     if result == "" then
  117.         result = "ZERO"
  118.     end
  119.     return (string.gsub(result, " +$", ""))
  120. end
  121.  
  122. function ConvertTo999(n)
  123.     if n <= 0 then
  124.         return ""
  125.     end
  126.    
  127.     local hundreds = math.floor(n / 100)
  128.     local tens = math.floor(n % 100)
  129.     local result = ""  
  130.    
  131.     if hundreds > 0 then
  132.     result = inverse_numbers[hundreds] .. "HUNDRED "
  133.     if tens == 0 then
  134.       return result
  135.     end
  136.  
  137.     result = result .. "AND "
  138.  
  139.     end
  140.  
  141.     if tens <= 20 then
  142.         return result .. inverse_numbers[tens]
  143.     end
  144.  
  145.     result = result .. inverse_numbers[math.floor(tens / 10) * 10]
  146.  
  147.     local digits = math.floor(n % 10)
  148.  
  149.     if digits > 0 then
  150.         result = result ..  inverse_numbers [digits]
  151.     end
  152.  
  153.     return result
  154. end
  155.  
  156. function sendChatMessage(msg)
  157.     game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(msg,"All")
  158. end
  159.  
  160. local Humanoid = game.Players.LocalPlayer.Character.Humanoid
  161. if JJtype == "JJ" then
  162.     for i=1,AmountOfJJs do
  163.         sendChatMessage(ConvertNumToWords(i))
  164.         Humanoid.Jump = true
  165.         wait(TimeBetweenMessages)
  166.         if not Humanoid then return end
  167.     end
  168. elseif JJtype == "HJ" then
  169.     for i=1,AmountOfJJs do
  170.         local thisWord = ConvertNumToWords(i)
  171.         for i=1,string.len(thisWord) do
  172.             sendChatMessage(string.sub(thisWord,i,i))
  173.             Humanoid.Jump = true
  174.             wait(TimeBetweenMessages)
  175.             if not Humanoid then return end
  176.         end
  177.         sendChatMessage(thisWord)
  178.         Humanoid.Jump = true
  179.         wait(TimeBetweenMessages)
  180.         if not Humanoid then return end
  181.     end
  182. elseif JJtype == "PJ" then
  183.     for i=1,AmountOfJJs do
  184.         local thisWord = ConvertNumToWords(i)
  185.         local ActualMessage = ""
  186.         for i=1,string.len(thisWord) do
  187.             if i > 1 then
  188.                 ActualMessage = ActualMessage.. " "
  189.             end
  190.             local thisLetter = string.sub(thisWord,i,i)
  191.             local thisPhonetic = phonetics[thisLetter]
  192.             ActualMessage = ActualMessage.. thisPhonetic
  193.         end
  194.         sendChatMessage(ActualMessage)
  195.         Humanoid.Jump = true
  196.         wait(TimeBetweenMessages)
  197.         if not Humanoid then return end
  198.     end
  199. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement