RustTip

OnCodeChanged

OxideCarbonStructure

Called when a code is changed.

void OnCodeChanged(BasePlayer player, CodeLock codeLock, string local0, bool local1)
Works — the game method in this build is the one the hook was written for.

Parameters

player
BasePlayer
codeLock
CodeLock
local0
string
local1
bool

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnCodeChanged(BasePlayer player, CodeLock codeLock, string local0, bool local1)
{
    Puts("OnCodeChanged");
}

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

Injection point

Rust.opj (Oxide)
void CodeLock.RPC_ChangeCode(BaseEntity.RPCMessage)

Passes: BasePlayer player, CodeLock codeLock, string local0, bool local1

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (a0.player, this, l0, l1)Assembly-CSharp.dll

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

// …
		guestCode = text;
		hasGuestCode = guestCode.Length > 0;
		guestPlayers.Clear();
		guestPlayers.Add(rpc.player.userID);
	}
	DoEffect(effectCodeChanged.resourcePath);
	SendNetworkUpdate();
	UpdateParentBox();
	Interface.CallHook("OnCodeChanged", rpc.player, this, text, flag);
	MarkGroupUpkeepDirty();
}

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.