Advertisement
Alexr360

Bombardment

Apr 13th, 2024 (edited)
702
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 1 0
  1. -- Define the function to generate random coordinates within a specified range
  2. local function getRandomCoordinates(range)
  3.     return math.random(-range, range)
  4. end
  5.  
  6. -- Define the range around (0, 0, 0)
  7. local range = 200 -- Adjust this value as needed
  8.  
  9. -- Define the function to execute the command with randomized coordinates
  10. local function executeNuclearBombCommand()
  11.     -- Generate random coordinates
  12.     local targetX = getRandomCoordinates(range)
  13.     local targetY = 150
  14.     local targetZ = getRandomCoordinates(range)
  15.    
  16.     -- Execute the command with the randomized coordinates
  17.     commands.exec("summon tfmg:napalm_bomb_entity " .. targetX .. " " .. targetY .. " " .. targetZ .. " {Fuse:600}")
  18.     print("bombing");
  19. end
  20.  
  21. -- Define the function to handle timer events
  22. local function timerEventHandler(timerId)
  23.     if timerId == timerId then
  24.         -- Execute the command
  25.         executeNuclearBombCommand()
  26.         executeNuclearBombCommand()
  27.         executeNuclearBombCommand()
  28.         executeNuclearBombCommand()
  29.         executeNuclearBombCommand()
  30.         executeNuclearBombCommand()
  31.         executeNuclearBombCommand()
  32.         executeNuclearBombCommand()
  33.         executeNuclearBombCommand()
  34.         executeNuclearBombCommand()
  35.         executeNuclearBombCommand()
  36.         executeNuclearBombCommand()
  37.         executeNuclearBombCommand()
  38.         executeNuclearBombCommand()
  39.         executeNuclearBombCommand()
  40.         executeNuclearBombCommand()
  41.         executeNuclearBombCommand()
  42.         executeNuclearBombCommand()
  43.         executeNuclearBombCommand()
  44.         executeNuclearBombCommand()
  45.        
  46.         -- Reschedule the timer for the next minute
  47.         os.startTimer(30)
  48.     end
  49. end
  50.  
  51. -- Start the timer for the first execution
  52. os.startTimer(1)
  53.  
  54. -- Listen for timer events
  55. while true do
  56.     local event, timerId = os.pullEvent("timer")
  57.     timerEventHandler(timerId)
  58. end
  59.  
Advertisement
Comments
  • gamestef
    44 days
    # text 0.17 KB | 0 0
    1. Hey man,
    2.  
    3. truly some good coding, im trying to learn how to in lua, would you mind explaining me some stuff? - If so, you can add me on Discord (stvni.xyz), thanks a lot!
Add Comment
Please, Sign In to add comment
Advertisement