Advertisement
Barnet

Gaydar

Jun 16th, 2021 (edited)
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. chat = peripheral.wrap("back")
  2. detector = peripheral.wrap("bottom")
  3.  
  4. while true do
  5.   event, username, message = os.pullEvent("chat")
  6.   if message ~= nil and message ~= "" then
  7.     words = {}
  8.        for word in message:gmatch("%S+") do
  9.          table.insert(words, word)
  10.        end
  11.        words[1] = string.lower(words[1])
  12.        if words[1] == "gaydar" and words[2] ~= nil then
  13.          target = words[2]
  14.          pos = detector.getPlayerPos(target)
  15.        if pos ~= nil then
  16.          response = target .. ": " .. pos["x"] .. ", " .. pos["y"] .. ", " .. pos["z"]
  17.          chat.sendMessageToPlayer(response, username)
  18.          print("-> " .. username .. ": " .. response)
  19.       end      
  20.     end
  21.   end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement