RustTip

OnPlayerDisconnected

OxideCarbonPlayer

Called when a player disconnects.

void OnPlayerDisconnected(BasePlayer local0, string strReason)
Works — the game method in this build is the one the hook was written for.

Parameters

local0
BasePlayer
strReason
string

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnPlayerDisconnected(BasePlayer local0, string strReason)
{
    Puts("OnPlayerDisconnected");
}

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

Injection point

Rust.opj (Oxide)
void ServerMgr.OnDisconnected(string, Network.Connection)

Passes: BasePlayer local0, string strReason

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

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

// …
	if (connection.authStatusSteam == "ok")
	{
		PlatformService.Instance.EndPlayerSession(connection.userid);
	}
	EACServer.OnLeaveGame(connection);
	BasePlayer basePlayer = connection.player as BasePlayer;
	if (basePlayer != null)
	{
		Interface.CallHook("OnPlayerDisconnected", basePlayer, strReason);
		basePlayer.OnDisconnected();
	}
	if (connection.authStatusNexus == "ok")
	{
		NexusServer.Logout(connection.userid);
	}
}

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.