OnRconCommand
OxideCarbonGlobalCalled when an RCON command is received from a remote client.
Provides access to the raw RCON message so you can log or modify behavior.
object OnRconCommand(System.Net.IPAddress ip, string command, string[] arguments)Works — the game method in this build is the one the hook was written for.
Parameters
- ip
- System.Net.IPAddress
- command
- string
- arguments
- string[]
Return value
objectReturn non-null to cancel the game action.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnRconCommand(System.Net.IPAddress ip, string command, string[] arguments)
{
Puts("OnRconCommand");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return false; // non-null cancels the game action
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Where it is called
Oxide core (Oxide.Rust)
RustCore::IOnRconMessage(IPAddress ipAddress, string command)
Oxide core code — the hook is called from here
// …
string[] fullCommand = CommandLine.Split(message.Message);
if (fullCommand.Length >= 1)
{
string cmd = fullCommand[0].ToLower();
string[] args = fullCommand.Skip(1).ToArray();
if (Interface.CallHook("OnRconCommand", ipAddress, cmd, args) != null)
{
return true;
}
}
}
return null;
}Injection point
Carbon
void Facepunch.RCon.OnCommand(Facepunch.RCon.Command cmd)
WorksAssembly-CSharp
Where it is called (this branch's game code)
private static void OnCommand(Command cmd)
{
try
{
if (Interface.CallHook("OnRconCommand", ip, command, arguments) != null)
{
return;
}
responseIdentifier = cmd.Identifier;
responseConnection = cmd.ConnectionId;
isInput = true;
if (Print)
{
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.