Hello,
Is there a hook that detects whether a person drop an item.
People crash my server by droping items.
Regards
Detecting when a player drops an item?
Discussion in 'Hurtworld Development' started by MonkeY12, May 28, 2017.
-
Perhaps this?
Code:void OnItemDrop(Inventory inventory, int slot) { Puts("OnItemDrop works!"); }
-
This hook only show droped item but i need know who drop the item
-
-
This should give you some info
Code:private void OnItemDrop(Inventory inventory, int slot) { PrintWarning($"Calling OnItemDrop({inventory}, {slot})"); var networkview = inventory.GetComponent<uLinkNetworkView>().owner; var playerSession = GameManager.Instance.GetSession(networkview); if (playerSession != null) Puts($" Player: {playerSession.Identity.Name}"); else Puts($" Inventory: {inventory}"); }
-
Wulf Community Admin
-
I love you <3
Thank u !
EDIT: Its possible to check droped item ?
19:01 [Warning] [Check] Calling OnItemDrop(PlayerServer(Clone) (PlayerInventory), 19)
19:01 [Info] [Check] Player: LeedeKLast edited by a moderator: Jun 16, 2017 -
Code:inventory.Items[slot].Item.GetNameKey()
-
Code:
19:22 [Warning] Calling 'OnItemDrop' on 'Check v1.0.0' took 793ms [GARBAGE COLLECT] 19:22 [Warning] [Check] Calling OnItemDrop(GroundDrillDynamicConstructed(Clone) (FuelSlotInventory), 1) 19:22 [Info] [Check] Inventory: GroundDrillDynamicConstructed(Clone) (FuelSlotInventory) 19:22 [Error] Failed to call hook 'OnItemDrop' on plugin 'Check v1.0.0' (NullReferenceException: Object reference not set to an instance of an object) 19:22 [Stacktrace] at Oxide.Plugins.Check.OnItemDrop (.Inventory inventory, Int32 slot) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Check.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [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 hook, System.Object[] args) [0x00000] in <filename unknown>:0
-
How to make to remove items after throwing 50,100items ?
Or kicked player who throws 50,100items