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)
Works — the game method in this build is the one the hook was written for.

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

WorksReturnBehavior: 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.