Advertisement
JohnDog3112

kill

Mar 17th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. back = peripheral.wrap("back")
  2. run = ""
  3. argsss = {...}
  4. args = argsss
  5. function kill()
  6. while true do
  7. mobs = back.sense()
  8. for i = 1, #mobs do
  9. for s = 1, #args do
  10. if args[s] ~= 0 then
  11. if mobs[i].name == args[s] then
  12. local entity = mobs[i]
  13. local x, y, z = entity.x, entity.y, entity.z
  14. local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
  15. local yaw = math.atan2(-x, z)
  16. back.fire(math.deg(yaw), math.deg(pitch), 5)
  17. i = #mobs
  18. sleep(0.5)
  19. end
  20. end
  21. end
  22.  
  23. end
  24. end
  25. end
  26. function reads()
  27.  
  28. while run ~= "stop" do
  29. split = {}
  30. argum = {}
  31. arguments = 0
  32. run = read()
  33. if run ~= "stop" then
  34. split[0] = 0
  35. for i = 1, string.len(run) do
  36. if string.sub(run,i, i) == " " then
  37.  
  38.  
  39. split[#split+1] = i
  40.  
  41. if (#split == 0) then
  42. argum[0] = string.sub(run,split[#split-1]+1, i-1)
  43. else
  44. argum[#argum+1] = string.sub(run,split[#split-1]+1, i-1)
  45. end
  46.  
  47. end
  48. end
  49. split[#split+1] = string.len(run)
  50. argum[#argum+1] = string.sub(run, split[#split-1]+1, string.len(run))
  51. if argum[1] == "add" and #argum > 0 then
  52. length = #args
  53. for i = 2, #argum do
  54. args[length+i] = argum[i]
  55. print(args[length+i])
  56. end
  57. end
  58.  
  59.  
  60. end
  61. end
  62. end
  63. parallel.waitForAny(reads, kill)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement