Skip to content
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

Adding a component to a weapon object after trying to add and remove a VARMOD component causes native exception to be thrown #2500

Open
Lxk3y opened this issue May 7, 2024 · 1 comment
Labels
bug ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action

Comments

@Lxk3y
Copy link

Lxk3y commented May 7, 2024

What happened?

When trying to add a component using GiveWeaponComponentToWeaponObject to a weapon object created with CreateWeaponObject after trying to add and remove a VARMOD component using GiveWeaponComponentToWeaponObject and RemoveWeaponComponentFromWeaponObject (and it not working?), it causes a native level exception to be thrown. The exception is the following:

image

I am unsure of how varmods work exactly, but it doesnt appear to be super well documented so this may well be a case of "not adding them correctly causes this exception". Either way, this seems funky and I don't think this should be happening.

Script to use for the reproduction scripts:
test_script.zip

Expected result

Native exception should not be thrown. Instead, a more clear error indicating the issue (or no error at all?) should be shown.

Reproduction steps

  1. Type /spawnweapon. This will create a weapon object (weapon_pistol) inside your ped (just walk forward to see it)
  2. Type /addvarmod. You will see that it doesnt appear to do anything
  3. Type /removevarmod. Again, this will appear to do nothing
  4. Type /addsupp. This should add a suppressor to the pistol but doesnt. Instead, check F8 to observe the error thrown

Importancy

Slight inconvenience

Area(s)

FiveM, Natives, ScRT: Lua

Specific version(s)

FiveM, b2699

Additional information

Again, i am not sure whats so different about these varmods but they seem to cause some funky behaviour. They dont seem to work when trying to add them using the same method used to add non varmod components, and they also throw this native exception if you try and add them and then remove them from a weapon, and then try to add a standard component.

You will also notice that if you follow step 1 and 2, but then skip to step 4, the component again does NOT get added, but no exception is thrown. This suggests there's something funky going on when trying to remove the varmod component.

@Lxk3y Lxk3y added bug triage Needs a preliminary assessment to determine the urgency and required action labels May 7, 2024
@github-actions github-actions bot added the ScRT: Lua Issues/PRs related to the Lua scripting runtime label May 7, 2024
@Lxk3y
Copy link
Author

Lxk3y commented May 7, 2024

I would just like to add that, if VARMODs work differently, some documentation on how exactly they differ from standard components would be much appreciated. As my repo steps show, they are definitely not working the same as standard components in some way when it comes to adding them to weapon objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

1 participant