Skip to content

OnRfFrequencyChange

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnRfFrequencyChange( Detonator instance, int freq, BasePlayer player )
{
    Puts( "OnRfFrequencyChange works!" );
}
csharp
private void OnRfFrequencyChange( PagerEntity instance, int num, BasePlayer player )
{
    Puts( "OnRfFrequencyChange works!" );
}
csharp
private void OnRfFrequencyChange( RFBroadcaster instance, int num, BasePlayer player )
{
    Puts( "OnRfFrequencyChange works!" );
}
csharp
private void OnRfFrequencyChange( RFReceiver instance, int num, BasePlayer player )
{
    Puts( "OnRfFrequencyChange works!" );
}

Location

  • Detonator::ServerSetFrequency(BasePlayer player, int freq)
  • PagerEntity::ServerSetFrequency(BaseEntity/RPCMessage msg)
  • RFBroadcaster::ServerSetFrequency(BaseEntity/RPCMessage msg)
  • RFReceiver::ServerSetFrequency(BaseEntity/RPCMessage msg)
csharp
//---
	if (RFManager.IsReserved(freq))
	{
		RFManager.ReserveErrorPrint(player);
		return;
	}
	if (Interface.CallHook("OnRfFrequencyChange", this, freq, player) != null)
	{
		return;
	}
	Item ownerItem = base.GetOwnerItem();
	RFManager.ChangeFrequency(this.frequency, freq, this, false, base.IsOn());
//---
csharp
//---
	{
		return;
	}
	this.nextChangeTime = Time.time + 2f;
	int num = msg.read.Int32();
	if (Interface.CallHook("OnRfFrequencyChange", this, num, msg.player) != null)
	{
		return;
	}
	RFManager.ChangeFrequency(this.frequency, num, this, true, true);
	this.frequency = num;
//---
csharp
//---
	{
		RFManager.ReserveErrorPrint(msg.player);
		return;
	}
	RFManager.ChangeFrequency(this.frequency, num, this, false, this.IsPowered());
	if (Interface.CallHook("OnRfFrequencyChange", this, num, msg.player) != null)
	{
		return;
	}
	this.frequency = num;
	this.MarkDirty();
//---
csharp
//---
	if (msg.player == null || !msg.player.CanBuild())
	{
		return;
	}
	int num = msg.read.Int32();
	if (Interface.CallHook("OnRfFrequencyChange", this, num, msg.player) != null)
	{
		return;
	}
	num = RFManager.ClampFrequency(num);
	RFManager.ChangeFrequency(this.frequency, num, this, true, true);
//---

Released under the MIT License.