RustTip

OnPlayerSleep

OxideCarbonPlayer

Called to validate a player's dismount position before exiting a mount or vehicle.

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

Parameters

basePlayer
BasePlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnPlayerSleep(BasePlayer basePlayer)
{
    Puts("OnPlayerSleep");
}

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

Injection point

Rust.opj (Oxide)
void BasePlayer.StartSleeping()

Passes: BasePlayer basePlayer

WorksReturnBehavior: ContinueArgumentBehavior: JustThisAssembly-CSharp.dll

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

public virtual void StartSleeping()
{
	if (IsSleeping())
	{
		return;
	}
	Interface.CallHook("OnPlayerSleep", this);
	if (IsRestrained)
	{
		inventory.SetLockedByRestraint(flag: false);
	}
	bool flag = InSafeZone();
	float num = 1f;
	if (!flag && Rust.Application.isLoadingSave)
	{
// …

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.