Jump to content

Recommended Posts

Posted (edited)

 

my code is exactly the same, apparently this is a bug 1.1 The first entrance to the object and attachment of the object, it is apparently simply created without an attachment. the second creation corrects this until the next transition to the game.spacer.png

spacer.png

@ragempdev

Edited by M4ybe
ragempdev
Posted

The code was attached are inside a function, so this function is called on the command event,


try to create the object in a function and calling inside your command event, let me know!

 

 

Posted
Just now, M4ybe said:

 

the problem is solved, why didn’t I immediately guess) 1.1 is asynchronous

How you solved? If you can explain maybe works for other people with the same problem!

  • 1 month later...
Posted

function attachObject(player) {
    try {
        if (player && mp.players.exists(player)) {
            if (attachedObjects[player.id] != undefined) attachedObjects[player.id].destroy();

            if (player.getVariable('attachedObject') == null) return;
            let data = JSON.parse(player.getVariable('attachedObject'));
            let boneID = player.getBoneIndex(data.Bone);
            var object = mp.objects.new(data.Model, player.position,
                {
                    rotation: new mp.Vector3(0, 0, 0),
                    alpha: 255,
                    dimension: player.dimension
                });
            object.attachTo(player.handle, boneID, data.PosOffset.x, data.PosOffset.y, data.PosOffset.z, data.RotOffset.x, data.RotOffset.y, data.RotOffset.z, true, true, false, false, 0, true);
            attachedObjects[player.id] = object;
        }
    } catch (e) { } 
}

Help

  • 2 weeks later...
Posted
Am 4.6.2020 um 14:52 schrieb Xabi:

You have to do it clientside, serverside attachment function isn't implemented.

Does anybody know if this is ever going to happen?

The reason I ask is I would like to use JS server side, but I absolutely need this function.

  • 2 weeks later...
Posted
В 08.08.2020 в 20:37, Rimeau сказал:

Does anybody know if this is ever going to happen?

The reason I ask is I would like to use JS server side, but I absolutely need this function.

And what does not suit the client?

Posted
Am 23.8.2020 um 07:51 schrieb randzhamiya:

And what does not suit the client?

Not sure what you mean - I would like to attach an entity to an entity on the server side so it's synchronized to all clients, while using JS, but that does not seem to be an option right now

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.
×
×
  • Create New...