Skip to content

OnRconMessage

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private object OnRconMessage( IPAddress ipAddress, RemoteMessage message )
{
    Puts( "OnRconMessage works!" );
    return null;
}

Location

  • RustCore::IOnRconMessage(IPAddress ipAddress, string command)
csharp
private object IOnRconMessage(IPAddress ipAddress, string command)
{
	if (ipAddress != null && !string.IsNullOrEmpty(command))
	{
		RemoteMessage message = RemoteMessage.GetMessage(command);

		if (string.IsNullOrEmpty(message?.Message))
		{
			return null;
		}

		if (Interface.CallHook("OnRconMessage", ipAddress, message) != null)
		{
			return true;
		}

		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;
}

Released under the MIT License.