Advertisement
PouPeuu

shid

Dec 2nd, 2021 (edited)
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local function usage()
  4.     print("Usage:")
  5.     print("bomber command <hostname>")
  6.     print("bomber target <hostname>")
  7. end
  8.  
  9. local function waitForMessage()
  10.     if args[2] == nil then
  11.         usage()
  12.         return
  13.     end
  14.     rednet.host("xyz",args[2])
  15.     local senderId, message, protocol = rednet.receive()
  16.     if message[1] == nil then
  17.         waitForMessage()
  18.     end
  19.     print(message[1])
  20.     commands.exec("summon tnt "..message[1].." "..message[2].." "..message[3].."")
  21. end
  22.  
  23. if args[1] == "command" then
  24.     waitForMessage()
  25. elseif args[1] == "target" then
  26.     if args[2] == nil then
  27.         usage()
  28.         return
  29.     end
  30.     local computerId = {rednet.lookup("xyz",args[2])}
  31.     local x,y,z = gps.locate()
  32.     if x == nil then
  33.         print("its nil")
  34.         return
  35.     end
  36.     local pos = {x,y,z}
  37.     print(pos[1])
  38.     print(pos[2])
  39.     print(pos[3])
  40.     rednet.send(computerId[1],pos)
  41.     return
  42. else
  43.     usage()
  44. end
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement