openmultiplayer-query
Implements the needed builders and parsers for SA:MP's/Open Multiplayer's Query Mechanism, allowing a developer to retrieve data from a running server.
You cannot send RCON packets yet.
Installation
cargo add openmultiplayer_query
Examples
Check test/build.rs
and test/parse.rs
to see how to use the library.
Building
let mut packet = new?;
let mut rcon_packet = new?;
Parsing
use ;
// Assume you have a UDP socket running
let socket = bind?;
// We'll send a packet to `149.56.84.18:7777`
let address: Ipv4Addr = "149.56.84.18"..unwrap;
let port = 7777;
let mut packet = new?;
// ...
packet.build?; // This is needed in order to populate the data buffer with query data.
// Send the packet through the socket.
socket.send_to?;
let mut recv_buf = ;
socket.recv?;
let result: = .try_into;
// Use `result` as you please