Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local box = peripheral.find("chatBox") -- Finds a connected Chat Box
- local detector = peripheral.wrap("right") --Defines the Detector on the right
- if box == nil then error("Missing Chat Box") end
- if detector == nil then error("Missing Player Detector on right") end
- function tablelength(T)
- count = 0
- for _ in pairs(T) do count = count + 1 end
- return count
- end
- function sayPlayers(range)
- players = detector.getPlayersInRange(range)
- nPlayers = tablelength(players)
- for k,v in pairs(players) do
- box.sendMessageToPlayer(v..", welcome to Campicus' End Portal, Mob spawner and Zoo!", v)
- end
- end
- while true do
- sayPlayers(5)
- for x = 1,120 do
- sleep(1)
- players = detector.getPlayersInRange(5)
- if tablelength(players) > nPlayers then
- sayPlayers(5)
- end
- end
- end
Add Comment
Please, Sign In to add comment