-
Notifications
You must be signed in to change notification settings - Fork 70
Changed more events #91
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
Conversation
events now called ps-inventory
now called ps-inventory
xFutte
left a comment
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.
Code looks good, just needs to test that everything still works after the renaming.
|
if im correct this will be working with all latest qb updates |
|
What did you approve @Max-Storm-03? You got no clue what is going on. |
|
Hi there! Having a strange issue still with weapon attachments not being able to be viewed in inventory. With the latest core updates and up-to-date dependencies, I am still having this issue. Below are the steps I'm doing to get the error, at the request of Lenzh.
|
Is this while testing this PR? |
I had this before and after, yes. |
fixed the NUI callback GetWeaponData error
|
issue should now be fixed @FoxThirtySix |
| weapon: itemData.name, | ||
| ItemData: itemData, | ||
| }), | ||
| function(data) { |
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.
Please serialize the data we get through the event to prevent exploits.
| $(".item-info-description").html( | ||
| "<p><strong>Serial: </strong><span>" + | ||
| itemData.info.serie + | ||
| "</span></p><p><strong>Ammo: </strong><span>" + | ||
| itemData.info.ammo + | ||
| "</span></p><p><strong>Attachments: </strong><span>" + | ||
| attachmentString + | ||
| "</span></p>" | ||
| ); |
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.
Inserting html like this directly on an HTML element can be quite dangerous for exploding the code. A better solution would be to build up a couple of elements and then appending them to the item-info-description element. It could look somewhat like this:
const description = document.createElement("p");
const header = document.createElement("strong");
const value = document.createElement("span");
header.innerText = "Serial:";
value.innerText = item.info.ammo;
description.innerHTML = `${header} {value}`
document.querySelector(".item-info-description").appendChild(description)You can then loop over all the values inside the itemData.info array to output them all. Requires a little fiddling with the code above.
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.
this was default code from the old ps-inv just made it compat with new qb-core


with the new QB updates inventory events now needs to be called different