the player hook OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer)
this hook will throw exception when the target is a box
[Oxide] 5:35 PM [Error] Failed to call hook 'OnPlayerLoot' on plugin 'Beginner Protection' (ArgumentException: failed to convert parameters)
I guess oxide can not distinguish OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer)
and OnPlayerLoot(PlayerLoot lootInventory, BaseEntity targetEntity)
OnPlayerLoot hook issues in C#
Discussion in 'Rust Development' started by Kation, Apr 6, 2015.
-
Code:
[Oxide] 10:41 PM [Error] Failed to call hook 'OnPlayerLoot' on plugin 'StewLogPlugin' (ArgumentException: failed to convert parameters) [Oxide] 10:41 PM [Debug] at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
Code:void OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer) { Puts("1 works!"); } void OnPlayerLoot(PlayerLoot lootInventory, Item targetItem) { Puts("2 works!"); } void OnPlayerInput(BasePlayer player, InputState input) { }
Code:private void OnPlayerLoot(PlayerLoot lootInventory, BaseEntity targetEntity);