Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the function to generate random coordinates within a specified range
- local function getRandomCoordinates(range)
- return math.random(-range, range)
- end
- -- Define the range around (0, 0, 0)
- local range = 200 -- Adjust this value as needed
- -- Define the function to execute the command with randomized coordinates
- local function executeNuclearBombCommand()
- -- Generate random coordinates
- local targetX = getRandomCoordinates(range)
- local targetY = 150
- local targetZ = getRandomCoordinates(range)
- -- Execute the command with the randomized coordinates
- commands.exec("summon tfmg:napalm_bomb_entity " .. targetX .. " " .. targetY .. " " .. targetZ .. " {Fuse:600}")
- print("bombing");
- end
- -- Define the function to handle timer events
- local function timerEventHandler(timerId)
- if timerId == timerId then
- -- Execute the command
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- executeNuclearBombCommand()
- -- Reschedule the timer for the next minute
- os.startTimer(30)
- end
- end
- -- Start the timer for the first execution
- os.startTimer(1)
- -- Listen for timer events
- while true do
- local event, timerId = os.pullEvent("timer")
- timerEventHandler(timerId)
- end
Advertisement
Comments
-
- Hey man,
- 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