Jump to content
RAGE Multiplayer Community

How i can sync a object in player hand


DamonSalvatore
 Share

Recommended Posts

Hello guys, i have a problem.I can't attach a gas can in user hands.

lqgvNLp.png

 

The object stay's in the air.

I have this code in client_packages

    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);

What can i do next?

Please with the example

Edited by DamonSalvatore
Link to comment
Share on other sites

1 hour ago, Xabi said:

That created object has a property called notifyStreaming that you can set to true.

This way the object will call the entityStreamIn event when it's created, so you can attach it to the player.

You can give a example? Because i don't understand what to do in entityStreamIn

Link to comment
Share on other sites

1 hour ago, Xabi said:

Just call the attachTo method there.

mp.events.add('entityStreamIn', (obj=> {
    var bone = mp.players.local.getBoneIndex(18905);
    position = new mp.Vector3(-0.125, -0.10.11);
    rotation = new mp.Vector3(200, -15);
 
    obj.attachTo(mp.players.local.handleboneposition.xposition.yposition.zrotation.xrotation.yrotation.ztruefalsefalsefalse2false);
});
 
But when i spawn a vehicle, the vehicle will follow player
Link to comment
Share on other sites

  • 2 weeks later...
On 12/29/2020 at 6:43 PM, DamonSalvatore said:
mp.events.add('entityStreamIn', (obj=> {
    var bone = mp.players.local.getBoneIndex(18905);
    position = new mp.Vector3(-0.125, -0.10.11);
    rotation = new mp.Vector3(200, -15);
 
    obj.attachTo(mp.players.local.handleboneposition.xposition.yposition.zrotation.xrotation.yrotation.ztruefalsefalsefalse2false);
});
 
But when i spawn a vehicle, the vehicle will follow player

use > if(obj == yourobj)

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...