OnServerCommand
Usage
- Return a non-null value to override default behavior
Example Autogenerated
csharp
private object OnServerCommand( ConsoleSystem.Arg arg )
{
Puts( "OnServerCommand works!" );
return null;
}
csharp
private object OnServerCommand( string cmd, string[] arg )
{
Puts( "OnServerCommand works!" );
return null;
}
Location
- RustCore::object IOnServerCommand(ConsoleSystem.Arg arg)(ConsoleSystem.Arg arg)
- RustCore::object IOnServerCommand(ConsoleSystem.Arg arg)(ConsoleSystem.Arg arg)
csharp
private object IOnServerCommand(ConsoleSystem.Arg arg)
{
// Ignore invalid connections
if (arg == null || arg.Connection != null && arg.Player() == null)
{
return true;
}
// Ignore all chat messages
if (arg.cmd.FullName == "chat.say" || arg.cmd.FullName == "chat.teamsay" || arg.cmd.FullName == "chat.localsay")
{
return null;
}
// Is the command blocked?
object commandSpecific = Interface.CallHook("OnServerCommand", arg);
object commandCovalence = Interface.CallHook("OnServerCommand", arg.cmd.FullName, RustCommandSystem.ExtractArgs(arg));
object canBlock = commandSpecific is null ? commandCovalence : commandSpecific;
if (canBlock != null)
{
return true;
}
return null;
}
csharp
private object IOnServerCommand(ConsoleSystem.Arg arg)
{
// Ignore invalid connections
if (arg == null || arg.Connection != null && arg.Player() == null)
{
return true;
}
// Ignore all chat messages
if (arg.cmd.FullName == "chat.say" || arg.cmd.FullName == "chat.teamsay" || arg.cmd.FullName == "chat.localsay")
{
return null;
}
// Is the command blocked?
object commandSpecific = Interface.CallHook("OnServerCommand", arg);
object commandCovalence = Interface.CallHook("OnServerCommand", arg.cmd.FullName, RustCommandSystem.ExtractArgs(arg));
object canBlock = commandSpecific is null ? commandCovalence : commandSpecific;
if (canBlock != null)
{
return true;
}
return null;
}