Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Load SecuNet api
- os.loadAPI("path/to/secunet/installation/secunet/apis/secunet.lua")
- -- This function will run while a background listener process listens for messages
- local function my_script()
- -- Send a packet to destination_user
- secunet.send("Hello there!", "destination_user") -- Replace this with their secunet user id
- -- Print out any received packet
- local sender, message = secunet.receive()
- print("Got packet from " .. sender .. ": \"" .. message .."\"") -- E.g: Got packet from SecunetUser: "Hello!"
- -- Disconnect from the server
- secunet.disconnect()
- end
- -- Port
- local port = 4000 -- Default SecuNet port
- -- Modem side
- local modem_side = "top" -- SecuNet's default modem side is top
- -- Prompt user for login
- local username, password = secunet.login()
- -- Run the listener process while running your script
- secunet.mainloop(my_script, username, password, port, modem_side) -- username: Users secunet username. Not necessarily MC username
- -- password: User's secunet password
- -- modem_side: side modem is on
- -- port: port for network packets to be sent to server on.
- -- Should be same as server's port. Default is 4000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement