RustTip

OnPlayerConnected

OxideCarbonPlayer

Called when a remote RCON command is received.

Provides access to the raw RCON message so you can log or modify behavior.

void OnPlayerConnected(BasePlayer player)
Works — the game method in this build is the one the hook was written for.

Parameters

player
BasePlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnPlayerConnected(BasePlayer player)
{
    Puts("OnPlayerConnected");
}

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

Where it is called

Oxide core (Oxide.Rust)
RustCore::IOnPlayerConnected(BasePlayer basePlayer)

Oxide core code — the hook is called from here

// …
    Covalence.PlayerManager.PlayerConnected(basePlayer);
    IPlayer player = Covalence.PlayerManager.FindPlayerById(basePlayer.UserIDString);
    if (player != null)
    {
        basePlayer.IPlayer = player;
        Interface.CallHook("OnUserConnected", player);
    }

    Interface.Oxide.CallHook("OnPlayerConnected", basePlayer);
}

Injection point

Rust.opj (Oxide)
void BasePlayer.PlayerInit(Network.Connection)

Injected internal hook IOnPlayerConnected — this hook is called by its handler in the Oxide/Carbon core

WorksReturnBehavior: ContinueArgumentBehavior: JustThisAssembly-CSharp.dll

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

// …
if ((bool)BaseGameMode.GetActiveGameMode(serverside: true))
{
	BaseGameMode.GetActiveGameMode(serverside: true).OnPlayerConnected(this);
}
if (net != null)
{
	EACServer.OnStartLoading(net.connection);
}
Interface.CallHook("IOnPlayerConnected", this);
if (IsAdmin)
{
	if (ConVar.AntiHack.noclip_protection <= 0)
	{
		ChatMessage("antihack.noclip_protection is disabled!");
	}
	if (ConVar.AntiHack.speedhack_protection <= 0)
	{
// …

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.