RustTip

OnNewSave

OxideCarbonServer

Called when a remote RCON command is received.

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

void OnNewSave(string strFilename)
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

strFilename
string

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnNewSave(string strFilename)
{
    Puts("OnNewSave");
}

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

Injection point

Rust.opj (Oxide)
bool SaveRestore.Load(string, bool)

Passes: string strFilename

Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (a0)Assembly-CSharp.dll

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

// …
try
{
	if (strFilename == "")
	{
		strFilename = World.SaveFolderName + "/" + World.SaveFileName;
	}
	if (!File.Exists(strFilename))
	{
		Interface.CallHook("OnNewSave", strFilename);
		if (!File.Exists("TestSaves/" + strFilename))
		{
			UnityEngine.Debug.LogWarning("Couldn't load " + strFilename + " - file doesn't exist");
			return false;
		}
		strFilename = "TestSaves/" + strFilename;
	}
	List<BaseEntity> list = FindMapEntities();
// …

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.