Server (24)

All currently available hooks that are found in Carbon. Most hooks would be ones compatible with Oxide, although there are Carbon-only ones as well.

  • Called before a command is broadcasted to all connected clients.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ConsoleNetwork.BroadcastToAllClients of Assembly-CSharp.dll.

Example
object OnBroadcastCommand(string strCommand, System.Object[] args)
{
    Puts("OnBroadcastCommand was called!");
    return (object) null;
}
  • Useful for intercepting server messages before they get to their intended target.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches BasePlayer.ChatMessage of Assembly-CSharp.dll.

Example
object OnMessagePlayer(string msg, BasePlayer self)
{
    Puts("OnMessagePlayer was called!");
    return (object) null;
}
  • Overrides Rust's native checks for command execution authorization.

  • Example: allow `inventory.give` to be executed by regular players.

  • Returning a non-null value cancels default behavior.

  • This hook is Carbon-only compatible.

  • Patches Arg.HasPermission.

Example
object OnNativeCommandHasPermission(ConsoleSystem.Arg arg)
{
    Puts("OnNativeCommandHasPermission was called!");
    return (bool) null;
}
  • Called when a new savefile is created (usually when map has wiped).

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches SaveRestore.Load of Assembly-CSharp.dll.

Example
void OnNewSave(string strFilename)
{
    Puts("OnNewSave was called!");
}
  • Called when a new RCON connection is opened.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches RConListener.ProcessConnections of Assembly-CSharp.dll.

Example
object OnRconConnection(System.Net.IPAddress address)
{
    Puts("OnRconConnection was called!");
    return (object) null;
}
  • Called when a save file is loaded.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches SaveRestore.Load of Assembly-CSharp.dll.

Example
object OnSaveLoad(System.Collections.Generic.Dictionary`2[[BaseEntity, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[ProtoBuf.Entity, Rust.Data, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]] local1)
{
    Puts("OnSaveLoad was called!");
    return (bool) null;
}

This hook requires OnNewSave, which loads alongside OnSaveLoad.

  • Called before a command is sent from the server to a player (or a group of players).

  • Usually commands aren't sent to a group of players, so in most cases it's safe to use only OnSendCommand with a single Connection.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ConsoleNetwork.SendClientCommand of Assembly-CSharp.dll.

Example
object OnSendCommand(Network.Connection cn, string strCommand, System.Object[] args)
{
    Puts("OnSendCommand was called!");
    return (object) null;
}
  • Called before a command is sent from the server to a player (or a group of players).

  • Usually commands aren't sent to a group of players, so in most cases it's safe to use only OnSendCommand with a single Connection.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ConsoleNetwork.SendClientCommand of Assembly-CSharp.dll.

Example
object OnSendCommand(Network.Connection cn, string strCommand, System.Object[] args)
{
    Puts("OnSendCommand was called!");
    return (object) null;
}
  • Gets called when executing a native command.

  • Useful for intercepting commands before they get to their intended target.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches CorePlugin.IOnServerCommand of Carbon.Common.dll.

Example
object OnServerCommand(ConsoleSystem.Arg arg)
{
    Puts("OnServerCommand was called!");
    return (bool) null;
}
  • Called after all steam information for the server has has been updated.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerMgr.UpdateServerInformation of Assembly-CSharp.dll.

Example
void OnServerInformationUpdated()
{
    Puts("OnServerInformationUpdated was called!");
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerMgr.Initialize of Assembly-CSharp.dll.

Example
void OnServerInitialize()
{
    Puts("OnServerInitialize was called!");
}
  • Called before a SERVER message is sent to a player.

  • Return a non-null value to stop message from being sent.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches Chat.Broadcast of Assembly-CSharp.dll.

Example
object OnServerMessage()
{
    Puts("OnServerMessage was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerMgr.RestartServer of Assembly-CSharp.dll.

Example
object OnServerRestart(string strNotice, int iSeconds)
{
    Puts("OnServerRestart was called!");
    return (object) null;
}

This hook requires OnServerRestartInterrupt, which loads alongside OnServerRestart.

  • Called when a server restart is being cancelled.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerMgr.RestartServer of Assembly-CSharp.dll.

Example
object OnServerRestartInterrupt()
{
    Puts("OnServerRestartInterrupt was called!");
    return (object) null;
}
  • Called before the server saves.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches SaveRestore.DoAutomatedSave of Assembly-CSharp.dll.

Example
void OnServerSave()
{
    Puts("OnServerSave was called!");
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerUsers.Remove of Assembly-CSharp.dll.

Example
void OnServerUserRemove()
{
    Puts("OnServerUserRemove was called!");
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerUsers.Set of Assembly-CSharp.dll.

Example
void OnServerUserSet()
{
    Puts("OnServerUserSet was called!");
}
  • Called every tick (defined by the tick rate of the server).

  • For better performance, avoid using heavy calculations in this hook.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ServerMgr.DoTick of Assembly-CSharp.dll.

Example
void OnTick()
{
    Puts("OnTick was called!");
}

Last updated