RustTip

OnDemoRecordingStop

OxideCarbonPlayer

Called when a demo recording stops.

object OnDemoRecordingStop(object RecordFilename, BasePlayer basePlayer)
Works — the game method in this build is the one the hook was written for.

Parameters

RecordFilename
object
basePlayer
BasePlayer

Return value

objectReturn non-null to cancel the game action.

Example

object — you can affect the game: return a value to change or cancel the action.

private object OnDemoRecordingStop(object RecordFilename, BasePlayer basePlayer)
{
    Puts("OnDemoRecordingStop");

    // change nothing — the game continues as usual
    return null;

    // to affect the game:
    // return false; // non-null cancels the game action
}

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

Injection point

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

Passes: object RecordFilename, BasePlayer basePlayer

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this.net.connection.RecordFilename, this)Assembly-CSharp.dll

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

public void StopServerDemoRecording()
{
	if (net != null && net.connection != null && net.connection.IsRecording)
	{
		if (Interface.CallHook("OnDemoRecordingStop", this.net.connection.RecordFilename, this) != null)
		{
			return;
		}
		Debug.Log(ToString() + " recording stopped: " + net.connection.RecordFilename);
		net.connection.StopRecording();
		CancelInvoke(actionMonitorServerDemoRecording);
	}
}

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.