Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This program is an example of how to use the server helper api, i might make a better documentation in the future but for now this is all you will get.
- -- This program turns on redstone output on the back of the computer if someon pays this computer 50 or more credits (with the "@computer pay" command). Then it pays the credits it got to the owner of the computer
- os.loadAPI("server.lua")
- server.getOwner()
- while true do
- info1,info2,info3,info4 = os.pullEvent()
- if info1 == "rednet_message" then
- local message = server.getMessageTable(info3)
- if message["action"] == "receivedPayment" and tonumber(message["amount"]) >= 50 then
- server.pay(owner, message["amount"], "You have received " .. message["amount"] .. "c from your computer.")
- redstone.setOutput("back",true)
- sleep(5)
- redstone.setOutput("back",false)
- end
- if message["action"] == "sendingOwner" then
- owner = message["owner"]
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement