smigger22

Flooder

Feb 16th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. chatBack = peripheral.wrap("back")
  2. rednet.open("left")
  3.  
  4. function floodPlayer(playerFrom, playerTo, msg, times)
  5.     for i = 1, #times do
  6.         chatBack.tell(player, msg)
  7.         sleep(1)
  8.     end
  9.     tellPlayer(playerFrom, "Success")
  10.     logPrint("flood", playerFrom, playerTo, msg)
  11.     return true
  12. end
  13.  
  14. function floodAll(playerFrom, msg, times)
  15.     for i = 1, #times do
  16.         chatBack.say(msg)
  17.         sleep(1)
  18.     end
  19.     tellPlayer(playerFrom, "Success")
  20.     logPrint("flood", playerFrom, "everybody", msg)
  21.     return true
  22. end
  23.  
  24. function logPrint(event, playerFrom, playerTo, msg)
  25.     if event == "flood" then
  26.         print(playerFrom.." flooded "..playerTo.. "with the message:")
  27.         print(string.rep("-"), 51)
  28.         print(msg)
  29.         print(string.rep("-"), 51)
  30.     end
  31. end
  32.  
  33. function tellPlayer(player, msg)
  34.     chat.tell(player, msg)
  35. end
  36.  
  37. function main()
  38.     local event, side, player, msg = os.pullEvent("chatbox_command")
  39.     command = {}
  40.     for v in chatMsg:gmatch("[^ ]+") do
  41.         table.insert(command, v)
  42.     end
  43.     if player == "smigger22" or player == "RodrickLord" or player == "jasperdekiller" then
  44.         if command[1] == "flood" then
  45.             if command[2] == "all" then
  46.                 floodAll(player, command[3], command[4])
  47.             elseif command[2] ~= "all" then
  48.                 if command[2] == "smigger22" or command[2] == "RodrickLord" or command[2] == "jasperdekiller" then
  49.                     tellPlayer(player, "You can't flood this user!")
  50.                 elseif command[2] ~= "smigger22" or command[2] ~= "RodrickLord" or command[2] ~= "jasperdekiller" then
  51.                     floodPlayer(player, command[2], command[3], command[4])
  52.                 end
  53.             end
  54.         end
  55.     end
  56. end
  57.  
  58. while true do
  59.     main()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment