RustTip

OnUserRespawned

OxideCarbonPlayer

Called when an user is respawned.

void OnUserRespawned(Oxide.Core.Libraries.Covalence.IPlayer player)
Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.

Parameters

player
Oxide.Core.Libraries.Covalence.IPlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnUserRespawned(Oxide.Core.Libraries.Covalence.IPlayer player)
{
    Puts("OnUserRespawned");
}

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

Where it is called

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

Oxide core code — the hook is called from here

private void OnPlayerRespawned(BasePlayer basePlayer)
{
    IPlayer player = basePlayer.IPlayer;
    if (player != null)
    {
        Interface.CallHook("OnUserRespawned", player);
    }
}

Injection point

Rust.opj (Oxide)
void BasePlayer.RespawnAt(Vector3, Quaternion, BaseEntity)

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

Method changed — checkReturnBehavior: ContinueArgumentBehavior: JustThisAssembly-CSharp.dll

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

// …
	}
	Analytics.Azure.OnPlayerRespawned(this, spawnPointEntity);
	if ((bool)activeGameMode)
	{
		BaseGameMode.GetActiveGameMode(serverside: true).OnPlayerRespawn(this);
	}
	if (IsConnected)
	{
		Interface.CallHook("OnPlayerRespawned", this);
		EACServer.OnStartLoading(net.connection);
	}
	ProcessMissionEvent(BaseMission.MissionEventType.RESPAWN, 0, 0f);
	PlayerInjureState = GetInjureState();
}

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.