RustTip

OnUserUnbanned

OxideCarbonPlayer

Called when an user is unbanned.

void OnUserUnbanned(string playerName, string playerId, string address)
Works — the game method in this build is the one the hook was written for.

Parameters

playerName
string
playerId
string
address
string

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnUserUnbanned(string playerName, string playerId, string address)
{
    Puts("OnUserUnbanned");
}

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

Where it is called

Oxide core (Oxide.Rust)
RustCore::OnServerUserRemove(ulong steamId)

Oxide core code — the hook is called from here

private void OnServerUserRemove(ulong steamId)
{
    if (serverInitialized && ServerUsers.users.ContainsKey(steamId) && ServerUsers.users[steamId].group == ServerUsers.UserGroup.Banned)
    {
        string playerId = steamId.ToString();
        IPlayer player = Covalence.PlayerManager.FindPlayerById(playerId);
        Interface.CallHook("OnPlayerUnbanned", player?.Name ?? "Unnamed", steamId, player?.Address ?? "0");
        Interface.CallHook("OnUserUnbanned", player?.Name ?? "Unnamed", playerId, player?.Address ?? "0");
    }
}

Injection point

Rust.opj (Oxide)
void ServerUsers.Remove(ulong)

Injected internal hook OnServerUserRemove — this hook is called by its handler in the Oxide/Carbon core

WorksReturnBehavior: ContinueArgumentBehavior: JustParamsAssembly-CSharp.dll

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

public static void Remove(ulong uid)
{
	Interface.CallHook("OnServerUserRemove", uid);
	users.Remove(uid);
}

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.