RustTip

OnClientAuth

OxideCarbonPlayer

Called when client auth occurs.

void OnClientAuth(Network.Connection connection)
Works — the game method in this build is the one the hook was written for.

Parameters

connection
Network.Connection

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnClientAuth(Network.Connection connection)
{
    Puts("OnClientAuth");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
void ServerMgr.OnGiveUserInformation(Network.Message)

Passes: Network.Connection connection

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (a0.connection)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
	return;
}
string text = string.Empty;
string text2 = BuildInfo.Current?.Scm?.Branch ?? string.Empty;
if (packet.read.Unread >= 4)
{
	text = packet.read.String(128);
}
Interface.CallHook("OnClientAuth", packet.connection);
if (!IsClientBranchAllowed(text2, text))
{
	if (!DeveloperList.Contains(packet.connection.userid))
	{
		DebugEx.Log("Kicking " + packet.connection?.ToString() + " - their branch is '" + text + "' not '" + text2 + "'");
		Net.sv.Kick(packet.connection, "Wrong Client Branch: Staging clients can't join release servers!");
		return;
	}
// …

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.