-
-
Notifications
You must be signed in to change notification settings - Fork 626
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
update(client): fire event on mounting weapon components #1553
Conversation
Technically can just use ox_inventory:updateInventory or ox_inventory:currentWeapon events fwiw |
First triggers on any update event. Second when the current weapon or its metadata changes; which gives you what you need. |
Yeah, for my needs it is pretty much sufficient, although I think it would be easier to work with the event in this pr in future. If this feat is not wanted, feel free to close it |
client.lua
Outdated
@@ -1542,6 +1543,7 @@ RegisterNUICallback('removeComponent', function(data, cb) | |||
|
|||
if success then | |||
RemoveWeaponComponentFromPed(playerPed, currentWeapon.hash, component) | |||
TriggerEvent('ox_inventory:updateWeaponComponents', "removed", currentWeapon, component) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ox_inventory:updateWeaponComponent
.
Use '
rather than "
(i.e. 'removed', 'added').
Send the item name of the component being used (not just the hash).
Don't think there's much need to send currentWeapon at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in latest commit, but double check it. I'll also PR 3095 weapons and components later
E: Do you want me to add hashes as 2nd arg? I didn't think of a case where you would need to get the exact hash of the item, so I haven't added it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TriggerEvent('ox_inventory:updateWeaponComponent', action --[['removed' | 'added']], component --[[hash]], componentItem --[[string]])
No description provided.