Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.find "modem"
- m.open(1103)
- local pos = settings.get "ChorOS.position"
- if not pos then error "CCSS Player Positions Agent requires the position to be set." end
- pos = vector.new(unpack(pos))
- while true do
- local _, _, ch, rch, msg = os.pullEvent "modem_message"
- if ch == 1103 and type(msg) == "table" then
- local ldist = math.huge
- for _, player in pairs(msg) do
- local ppos = vector.new(unpack(player, 2))
- local dist = (pos - ppos):length()
- if dist < 16 and dist < ldist then
- local plr = player[1]
- ldist = dist
- print("Detected", plr)
- os.queueEvent("ccss_update", ("Welcome, %s!"):format(plr))
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement