Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Zone editable du programme--
- local channel1 = 200
- local channel2 = 201
- --Ne pas toucher au programme apres cette ligne--
- local continuer = true
- local default = "Darking"
- function myperipheral(name)
- local function inlist(item,list)
- for n,m in pairs(list) do
- if m == item then
- return true
- end
- end
- return false
- end
- local side
- for k,v in pairs(peripheral.getNames()) do
- if string.find(v,name) then
- side = v
- elseif inlist(v,rs.getSides()) then
- if peripheral.getType(v) == name then
- side = v
- end
- end
- end
- if side ~= nil then
- print("Found "..name.." as "..side)
- return side
- else
- print("ERROR:"..name.." don't found")
- return nil
- end
- end
- print("-------Check Peripheral-------")
- side = myperipheral("openperipheral_sensor")
- r = peripheral.wrap(myperipheral("modem"))
- print("-------End Check Peripheral-------")
- if side ~= nil then
- s = peripheral.wrap(side)
- first = s.getPlayers()
- default = first[1].name
- end
- if os.getComputerLabel() == nil then
- print("Error: No Computer's Label")
- print("Pour Labeliser un computer la commande est :")
- print("label set <nom>")
- print("Par exemple \"label set "..default.."Base\"")
- continuer = false
- end
- while continuer do
- list = s.getPlayers()
- local l={}
- for n,m in pairs(list) do
- if m~=nil then
- table.insert(l,m.name)
- end
- end
- message = {name=os.getComputerLabel(),players=l}
- r.transmit(channel2,channel1,textutils.serialize(message))
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement