Advertisement
E-Kemp

Valley Player Listener

Feb 26th, 2023 (edited)
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. os.loadAPI("storage.lua")
  2.  
  3. modem = peripheral.wrap("bottom")
  4. chat = peripheral.wrap("right")
  5.  
  6. modem.open(6664)
  7.  
  8. while true do
  9.   local event, side, frequency, replyFrequency, message, distance = os.pullEvent("modem_message")
  10.   local stats = storage.getStorage()
  11.  
  12.   if frequency == 6664 then
  13.     local player = message["player"] or nil
  14.     if player ~= nil then
  15.       stats.players[player] = os.day() + 1
  16.       modem.transmit(replyFrequency, 6664, { status = "ok", [message["type"]] = stats })
  17.       storage.setStorage(stats)
  18.     end
  19.   end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement