SHARE
TWEET

Test1

a guest Sep 20th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fs.makeDir("SpawnControl")
  2.  
  3. local function istable(t) return type(t) == 'table' end
  4.  
  5. local Connecting = true
  6. local Port = 6572
  7.  
  8. local Modem = peripheral.wrap(ModemSide)
  9. Modem.open(Port)
  10.  
  11. Modem.transmit(6571, Port, "Connect")
  12. while Connecting == true do
  13.    
  14.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  15.         if istable(message) then
  16.             local info = message
  17.             local port = info.Port
  18.             local mtype = info.MobType
  19.             local bl  = 0
  20.             save_config(port,mobtype,bl)
  21.             Modem.transmit(port, Port, "Success")
  22.         end
  23.  
  24.     print("more Modems? y/n")
  25.    
  26.     if read() == "n" then
  27.         Connecting = false
  28.     end
  29.  
  30. end
  31.  
  32. function save_config(a,b,c)
  33.     sw = fs.open("config.txt", "w")  
  34.     sw.writeLine(a)
  35.     sw.writeLine(b)
  36.     sw.writeLine(c)
  37.     sw.close()
  38. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top