OnClientCommand
Usage
- Return a non-null value to override default behavior
Example Autogenerated
csharp
private object OnClientCommand( Network.Connection connection, string text )
{
Puts( "OnClientCommand works!" );
return null;
}Location
- ConsoleNetwork::OnClientCommand(Network.Message packet)
csharp
//---
string text = packet.read.StringRaw(ConVar.Server.maxpacketsize_command);
if (packet.connection == null || !packet.connection.connected)
{
Debug.LogWarning("Client without connection tried to run command: " + text);
}
else if (Interface.CallHook("OnClientCommand", packet.connection, text) == null)
{
ConsoleSystem.CommandResult commandResult = ConsoleSystem.RunWithResult(ConsoleSystem.Option.Server.FromConnection(packet.connection).Quiet(), text);
if (commandResult.Result == ConsoleSystem.CommandResultType.Success && (packet.connection.authLevel != 0 || (commandResult.Command.ServerAdmin && !commandResult.Command.ServerUser)))
{
Facepunch.Rust.Analytics.Azure.OnClientRanCommand(packet.connection, text);
//---