-
-
Notifications
You must be signed in to change notification settings - Fork 488
Description
Is your feature request related to a problem? Please describe.
I wish to know when a player has been given or taken a weapon(s) with giveWeapon/takeWeapon/takeAllWeapons functions.
Describe the solution you'd like
I would like server-sided events such as 'onPlayerWeaponGiven' and 'onPlayerWeaponTaken' which are triggered before 'giveWeapon' or 'takeWeapon' is executed so that I can cancel the event. For both events the source is obviously a player element and the handler will supply a weapon id. I'm not quite sure how one should handle 'takeAllWeapons' but I assume you could trigger 'onPlayerWeaponTaken' for each weapon in the player's inventory.
Describe alternatives you've considered
The only alternative I could think of is using 'addDebugHook' which according the wiki description "should only be used when debugging scripts as it may degrade script performance" thus it is far from optimal. For most of my usecases I needed to prevent certain weapons from being given whenever a certain condition is met, e.g. when a player is inside a collision shape, etc. I know that for certain bespoke servers it isn't needed but I would like to keep my resources decoupled from eachother (especially freeroam) and I think this event will help with that.
Additional context