rebar-altv icon indicating copy to clipboard operation
rebar-altv copied to clipboard

Rebar.usePlayer(player).attachment.remove not work

Open kobo07 opened this issue 6 months ago • 0 comments

Rebar.usePlayer(player).attachment.remove

not work

i think i found why

function createAttachments has not push the new object to entityAttachments[]

async function createAttachments(player: alt.Player, attachments: Attachment[]) { entityAttachments[player.id] = [];

for (let attachment of attachments) {
    if (!attachment.rot) {
        attachment.rot = alt.Vector3.zero;
    }

    const object = new alt.LocalObject(
        attachment.model,
        player.pos,
        new alt.Vector3(attachment.rot),
        true,
        false,
        true,
        15,
    );

    await object.waitForSpawn();

    object.attachToEntity(
        player,
        attachment.bone,
        new alt.Vector3(attachment.offset),
        new alt.Vector3(attachment.rot),
        true,
        false,
        true,
    );
  //add this
    entityAttachments[player.id].push(object);
}

}

kobo07 avatar Aug 09 '24 20:08 kobo07