-
-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: New hook: useItem #1709
Comments
https://overextended.dev/ox_inventory/Functions/Client#weaponwheel this will disable the inventory while allowing you to shoot still exports.ox_inventory:weaponWheel(true)
GiveWeaponToPed(cache.ped, self.private.weapon, 9999, false, true)
SetCurrentPedWeapon(cache.ped, self.private.weapon, true)
SetPedInfiniteAmmo(cache.ped, true, self.private.weapon)
SetPedInfiniteAmmoClip(cache.ped, true) here is an export from something ive useed it for. and then when the weaponwheel is disabled again, it will actually unequip the weapon given this way if they dont have it in their inventory. assuming you have the weapon mismatch checking on for the inventory ultimately the hook here is not that useful since if you register item uses through the export callbacks you have access to all the different stages of item use already. https://overextended.dev/ox_inventory/Guides/creatingItems#client-callbacks |
That is what we currently do to give a temporary weapon. I see what you're saying with the callbacks, but surely a hook is better to define the logic in one place of what can/cannot be used rather than in each callback? |
Yes the docs imply it but code wise it only disable weapons being used as far as I can see. Line 511 in 3f298a1
Regardless I still think having a hook for |
Interesting. I guess i can see the convenience of the hook in some cases then. |
Right now the docs state that enabling the weaponWheel via export will disable the use of inventory items, as a user reading the docs I would assume that is all items but this is not the case. It only disables weapons from being used Discussion: overextended/ox_inventory#1709
Is your feature request related to a problem? Please describe.
We have an arena system for players to do activities like 1v1s, we like to disable the players use of their inventory to prevent healing, putting armour on etc by using items in their inventory. Right now our only option is to disable use of the inventory all together. We tried to use
invBusy
state on the player, this works but has a side effect of no longer being able to shoot their weaponox_inventory/client.lua
Line 1422 in bb8f029
We could disable this ourself but we're trying to keep
ox_inventory
as vanilla as possible to make updates easier.This has led to the idea of making a useItem hook where we can return false if we want to stop the item from being used, then we can disable all items and setup a "whitelist" of allowed items that can be used while in the arena.
Describe the solution you'd like
Ability to create a hook for
useItem
that will allow us to cancel the request to use the item.Example:
Describe alternatives you've considered
(The alternatives below will prevent the inventory from opening and allowing weapon shooting, but won't allow us to dynamically cancel the
useItem
)invBusy
is true.invOpen
is true, and then call export tocloseInventory
immediately.Additional context
N/A
The text was updated successfully, but these errors were encountered: