RustTip

OnServerInitialize

OxideCarbonServer

Called when a server initializes.

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

Parameters

No parameters.

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnServerInitialize()
{
    Puts("OnServerInitialize");
}

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

Injection point

Rust.opj (Oxide)
void ServerMgr.Initialize(bool, string, bool, bool)

Passes: —

WorksReturnBehavior: ContinueArgumentBehavior: NoneAssembly-CSharp.dll

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

public bool Initialize(bool loadSave = true, string saveFile = "", bool allowOutOfDateSaves = false, bool skipInitialSpawn = false)
{
	Interface.CallHook("OnServerInitialize");
	persistance = new UserPersistance(Server.rootFolder);
	playerStateManager = new PlayerStateManager(persistance);
	TutorialIsland.GenerateIslandSpawnPoints(loadingSave: true);
	BasePlayer.InitInternalState();
	TriggerParent.InitInternalState();
	if ((bool)SingletonComponent<SpawnHandler>.Instance)
	{
		using (TimeWarning.New("SpawnHandler.UpdateDistributions"))
// …

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.