Advertisement
Dragon2fly

Minecraft AP Chatbox AFK notify

Mar 30th, 2023
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. local chatBox = peripheral.find("chatBox")
  2. local enabled = false
  3.  
  4. while true do
  5.   local signal = redstone.getInput("right")
  6.  
  7.   if signal and not enabled then
  8.     enabled = true
  9.     print("Enabled")
  10.   elseif not signal and enabled then
  11.     enabled = false
  12.     print("Disabled")
  13.   end
  14.  
  15.   if enabled then
  16.     local event, player, message = os.pullEvent("chat")
  17.     if string.find(message, "<YOUR USERNAME HERE>") then
  18.       chatBox.sendMessage("YOUR MESSAGE HERE")
  19.     end
  20.   end
  21.  
  22.   os.sleep(0.1)  -- Wait for a short time before checking again
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement