Jump to content
RAGE Multiplayer Community

How Attach object to player.


aLLeN92
 Share

Recommended Posts

Hi,

 

I try to add in server side to player an object, but really I don't know how, I spawn the object, but I don't know how to attach to player.

I use this line to spawn the object:

NAPI.Object.CreateObject(1868096318, PlayerPos, objPos, (255), (0));

native don't works on rage no? like Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY

 

or that is deprecated?

 

NAPI.Entity.AttachEntityToEntity(model, client, "IK_R_Hand", new Vector3(), new Vector3());

 

thanks, I appreciate!

 

 

 

Edited by aLLeN92
Link to comment
Share on other sites

4 часа назад, aLLeN92 сказал:

So, I suppose i need to use: 

Entity.attachTo

on client side, that's equivalent to AttachEntityToEntity?

 

thanks!

 

EDIT: obj.attachTo is not a function... any idea?

 

I tired it

RAGE.Game.Entity.AttachEntityToEntity(PlayerObject.Id, player.Id, RAGE.Game.Ped.GetPedBoneIndex(player.Id, 6286), 0, 0, 0, 0, 0, 0, false, false, false, true, 0, false);

But it's not working... 

RAGE.Game.Entity.IsEntityAttachedToEntity(PlayerObject.Id, player.Id)

This code return false...

wtf..

Link to comment
Share on other sites

3 hours ago, Лорд said:

I tired it

RAGE.Game.Entity.AttachEntityToEntity(PlayerObject.Id, player.Id, RAGE.Game.Ped.GetPedBoneIndex(player.Id, 6286), 0, 0, 0, 0, 0, 0, false, false, false, true, 0, false);

But it's not working... 

RAGE.Game.Entity.IsEntityAttachedToEntity(PlayerObject.Id, player.Id)

This code return false...

wtf..

 

I don't know really, I try to much forms, but at last the error as the same -> obj.attachTo is not a function.

First I create the object:

let obj = mp.objects.new(226364574, {
            position: new mp.Vector3(playCords),
            rotation: new mp.Vector3(000),
            alpha: 255,
            dimension: mp.players.local.dimension
            });
 
// And here I use the attach:
 
obj.attachTo(myIdboneposicion.xposition.yposition.zrotacion.xrotacion.yrotacion.zfalsefalsefalsefalse2true);
 
Link to comment
Share on other sites

SOLVED:

Well, really is not solved, I just learn the lesson, here is the code to attach object to your entity in client side:


		let bone = mp.players.local.getBoneIndex = 24818;
		position = new mp.Vector3(-0.1, -0.15, 0.11);
		rotation = new mp.Vector3(-180.0, 0.0, 0.0);
		
		let obj = mp.objects.new(242383520, mp.players.local.position, {
			rotation: new mp.Vector3(0, 0, 0),
			alpha: 255,
			dimension: mp.players.local.dimension
			});

			obj.attachTo(mp.players.local.handle, bone, position.x, position.y, position.z, rotation.x, rotation.y, rotation.z, true, false, false, false, 2, false);

 

 

Link to comment
Share on other sites

  • 2 weeks later...

this does not work for me, the first time the client is launched, a visible object is always created that is not attached to anything, but after repeated attachment, attach works and attaches to the bone, how can I overcome this error?

Link to comment
Share on other sites

10 hours ago, M4ybe said:

this does not work for me, the first time the client is launched, a visible object is always created that is not attached to anything, but after repeated attachment, attach works and attaches to the bone, how can I overcome this error?

Hi Friend,

 

post your code and I try to help you!

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...