Log in to reply
 

How to use this native function



  • Anyone know how to use the function REMOVE_WEAPON_COMPONENT_FROM_WEAPON_OBJECT ? I can use GIVE_WEAPON_COMPONENT_TO_WEAPON_OBJECT perfectly but when i want to remove the attached component it just doesn't do anything...

    I'm calling it like this: Function.Call(Hash.REMOVE_WEAPON_COMPONENT_FROM_WEAPON_OBJECT, /int/ objectHandle, /WeaponComponentHash/ compHash)



  • @JustDancePC Try this function instead?

    Function.Call(Hash.GIVE_WEAPON_COMPONENT_TO_PED, CurrentPed, WeaponHash.HeavyPistol, 0xC304849A); //suppressor

    and then see if you can remove it. Works for me.

    REMOVE_WEAPON_COMPONENT_FROM_PED(Ped ped, Hash weaponHash, Hash componentHash)//
    Sorry don't really know.



  • @JohnFromGWN Can't use those functions because it's not a weapon owned by a ped, it's a weapon object that I'm using for display



  • @JustDancePC If it's just for display why not just replace it. One moment it has the component, the next it doesn't. You can add it. Just replace it as the weapon without the component, no?



  • @JohnFromGWN Yes, that's the workaround I use, just delete and respawn the weapon without the component that i want to remove. But it would be way less complicated and more efficient to use that function, that's why i asked



  • @JustDancePC isn't it one extra tiny line of code, weapons delete?



  • @JohnFromGWN Deleting the weapon? Yes, but let's say i have flashlight, tint, camo, camo color, muzzle attachment, scope, custom clip and i only want to get rid of the muzzle attachment, that means i have to have all the attachments saved and when i create the weapon again i have to add all the other attachments. I already do this, it would be much better to use the function i mentioned


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.