RustTip

OnDestroyUI

OxideCarbonCUI

Called when destroy UI occurs.

void OnDestroyUI(BasePlayer player, string name)

Parameters

player
BasePlayer
name
string

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnDestroyUI(BasePlayer player, string name)
{
    Puts("OnDestroyUI");
}

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

Where it is called

Oxide core (Oxide.Rust)
JsonWriterResources::DestroyUi(BasePlayer player, string elem)

Oxide core code — the hook is called from here

public static bool DestroyUi(BasePlayer player, string elem)
{
    if (player?.net != null)
    {
        Interface.CallHook("OnDestroyUI", player, elem);
        CommunityEntity.ServerInstance.ClientRPC(RpcTarget.Player("DestroyUI", player.net.connection), elem);
        return true;
    }

    return false;
}

Injection point

Carbon
Oxide.Game.Rust.Cui.CuiHelper.DestroyUi
Inside CarbonCarbon.Common

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.