From 1e65441656d4d020e0cd6369d10e05dcf2cdfffe Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Tue, 9 Jan 2024 20:14:21 +0000 Subject: [PATCH] docs: updated README.md to reflect changes --- README.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63d50aa..b5c8533 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Rcon++ is a modern Source RCON library for C++, allowing people to easily use RC This library is used in: - [Factorio-Discord-Relay Revamped](https://github.com/Jaskowicz1/fdr-remake) +- RCON-UE If you're using this library, feel free to message me and show me, you might just get your project shown here! @@ -31,18 +32,26 @@ We do not test support for MinGW, nor do we want to actively try and support it. # Getting Started -rcon++ can be installed from the .deb file in the recent actions (soon to be released!). +rcon++ can be installed from the releases section! We're aiming to start rolling out to package managers soon! # Quick Example +### Client ```c++ #include #include int main() { rconpp::rcon_client client("127.0.0.1", 27015, "changeme"); + + client.on_log = [](const std::string_view& log) { + std::cout << log << "\n"; + }; + + client.start(true); + client.send_data("Hello!", 3, rconpp::data_type::SERVERDATA_EXECCOMMAND, [](const rconpp::response& response) { std::cout << "response: " << response.data << "\n"; }); @@ -51,6 +60,32 @@ int main() { } ``` +### Server +```c++ +#include +#include + +int main() { + rconpp::rcon_server server("0.0.0.0", 27015, "testing"); + + server.on_log = [](const std::string_view log) { + std::cout << log << "\n"; + }; + + server.on_command = [](const rconpp::client_command& command) { + if (command.command == "/test") { + return "This is a test!"; + } else { + return "Hello!"; + } + }; + + server.start(false); + + return 0; +} +``` + # Contributing If you want to help out, simply make a fork and submit your PR!