Hey.
Is the signature of the OnItemDropped in the Oxide API documentation correct?
If I use it with the signature provided in the documentation it throws a InvalidCastException.
I've checked on the types and those are Item and DroppedItem as it is stated in one of the changelogs.
So I guess the documentation entry is outdated?
Greetings
David
ps: Im not sure if this is the correct subforum to post this. If im wrong sorry in advance.
Solved OnItemDropped hook throwing InvalidCastExeption
Discussion in 'Rust Development' started by Tav Guard 1, Apr 6, 2017.
-
Wulf Community Admin
Could you show the exact error please?
-
Sure.
Signature: void OnItemDropped(Deployer deployer, BaseEntity entity) as stated in Oxide Rust API
Error: (19:39:59) | Failed to call hook 'OnItemDropped' on plugin 'InsertPluginNameHere v0.1.0' (InvalidCastException: Cannot cast from source type to destination type.)
Changing both parameters in the signature to object and putting the GetType() to Console says:
First parameter type: Item
Second parameter type: DroppedItem
Changing the signature of the hook to said types and it works like a charm. -
Wulf Community Admin
-
No problem