Skip to content

OnBuyVendingItem

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnBuyVendingItem( VendingMachine instance, BasePlayer player, int num, int num2 )
{
    Puts( "OnBuyVendingItem works!" );
}

Location

  • VendingMachine::BuyItem(BaseEntity/RPCMessage rpc)
csharp
//---
	if (this.IsVending())
	{
		rpc.player.ShowToast(GameTip.Styles.Red_Normal, VendingMachine.WaitForVendingMessage, false, Array.Empty<string>());
		return;
	}
	if (Interface.CallHook("OnBuyVendingItem", this, rpc.player, num, num2) != null)
	{
		return;
	}
	this.SetPendingOrder(rpc.player, num, num2);
	base.Invoke(new Action(this.CompletePendingOrder), this.GetBuyDuration());
//---

Released under the MIT License.