[HELP] How to use attachElements in a player's weapon.

Recommended Posts

I need to use attachElements with an object in a player's gun, but from what I noticed the player's weapon is not recognized as "element".


function customM4(source)
 	if getPedWeapon(source) == 31 then
		local gunModel = createObject(1487, 1, 2, 3)
		attachElements(gunModel, getPedWeapon(source)) 
addCommandHandler("m4skin", customM4)


Share this post

Link to post

There's a couple ways you can do that as far as I know:

a) Attach the object to the player element and try to figure out the rotation in a render loop.
b) Create a custom weapon, which you need to also manually attach for the player element.

The way you are trying to do it right now is not possible since a ped weapon is not an element.

Edited by myonlake

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.