item is NULL because the hook must be later
Now:
Need:Code:if (!this.plantProperty.pickupItem.condition.enabled) { ItemDefinition itemDefinition = this.plantProperty.pickupItem; long num1 = (long)0; Interface.CallHook("OnCropGather", this, item, msg.player); item = ItemManager.Create(itemDefinition, num, (ulong)num1); msg.player.GiveItem(item, BaseEntity.GiveItemReason.PickedUp); }
Code:if (!this.plantProperty.pickupItem.condition.enabled) { ItemDefinition itemDefinition = this.plantProperty.pickupItem; long num1 = (long)0; item = ItemManager.Create(itemDefinition, num, (ulong)num1); Interface.CallHook("OnCropGather", this, item, msg.player); msg.player.GiveItem(item, BaseEntity.GiveItemReason.PickedUp); }
Fixed OnCropGather item is null
Discussion in 'Rust Development' started by CaseMan, Apr 10, 2018.