Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local manager = peripheral.wrap("back")
- local chatBox = peripheral.wrap("left")
- local user = "Paramus200"
- function Info(item)
- --TODO
- return "TODO"
- end
- function Export(item, qty)
- return manager.addItemToPlayer("up", {name=item, count=qty})
- end
- function Insert(item, qty)
- return manager.removeItemFromPlayer("up", {name=item, count=qty})
- end
- function Request(query)
- local method, item, quantity
- for k, v in string.gmatch(query, "(%w+) (%w+)") do
- if (method == nil) then
- method = v
- elseif (item == nil) then
- item = v
- elseif (quantity == nil) then
- quantity =tonumber(v)
- end
- end
- if (method == "i") then
- chatBox.sendMessageToPlayer(Insert(item, quantity), user)
- elseif (method == "e") then
- chatBox.sendMessageToPlayer(Export(item, quantity), user)
- elseif (method == "info") then
- chatBox.sendMessageToPlayer(Info(item), user)
- end
- end
- while(true) do
- local event, username, message, uuid, isHidden = os.pullEvent("chat")
- if (username == user) then
- request(message)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment