Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- back = peripheral.wrap("back")
- run = ""
- argsss = {...}
- args = argsss
- function kill()
- while true do
- mobs = back.sense()
- for i = 1, #mobs do
- for s = 1, #args do
- if args[s] ~= 0 then
- if mobs[i].name == args[s] then
- local entity = mobs[i]
- local x, y, z = entity.x, entity.y, entity.z
- local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
- local yaw = math.atan2(-x, z)
- back.fire(math.deg(yaw), math.deg(pitch), 5)
- i = #mobs
- sleep(0.5)
- end
- end
- end
- end
- end
- end
- function reads()
- while run ~= "stop" do
- split = {}
- argum = {}
- arguments = 0
- run = read()
- if run ~= "stop" then
- split[0] = 0
- for i = 1, string.len(run) do
- if string.sub(run,i, i) == " " then
- split[#split+1] = i
- if (#split == 0) then
- argum[0] = string.sub(run,split[#split-1]+1, i-1)
- else
- argum[#argum+1] = string.sub(run,split[#split-1]+1, i-1)
- end
- end
- end
- split[#split+1] = string.len(run)
- argum[#argum+1] = string.sub(run, split[#split-1]+1, string.len(run))
- if argum[1] == "add" and #argum > 0 then
- length = #args
- for i = 2, #argum do
- args[length+i] = argum[i]
- print(args[length+i])
- end
- end
- end
- end
- end
- parallel.waitForAny(reads, kill)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement