Skip to content

OnSwitchToggled

Usage

  • No return behavior

Example Autogenerated

csharp
private void OnSwitchToggled( ElectricSwitch instance, BasePlayer player )
{
    Puts( "OnSwitchToggled works!" );
}
csharp
private void OnSwitchToggled( FuelGenerator instance, BasePlayer player )
{
    Puts( "OnSwitchToggled works!" );
}
csharp
private void OnSwitchToggled( IndustrialConveyor instance, BasePlayer player )
{
    Puts( "OnSwitchToggled works!" );
}

Location

  • ElectricSwitch::RPC_Switch(BaseEntity/RPCMessage msg)
  • FuelGenerator::RPC_EngineSwitch(BaseEntity/RPCMessage msg)
  • IndustrialConveyor::SvSwitch(BaseEntity/RPCMessage msg)
csharp
//---
	{
		return;
	}
	bool @switch = msg.read.Bool();
	this.SetSwitch(@switch);
	Interface.CallHook("OnSwitchToggled", this, msg.player);
}
csharp
//---
	{
		return;
	}
	bool generatorState = msg.read.Bit();
	this.SetGeneratorState(generatorState);
	Interface.CallHook("OnSwitchToggled", this, msg.player);
}
csharp
//---
	if (Interface.CallHook("OnSwitchToggle", this, msg.player) != null)
	{
		return;
	}
	this.SetSwitch(!base.IsOn());
	Interface.CallHook("OnSwitchToggled", this, msg.player);
}

Released under the MIT License.