Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mp.events.add('InTrunk', function(player, veh){
- const boneIndex = veh.getBoneIndexByName("boot");
- const pos = veh.position;
- const trunkPos = veh.getWorldPositionOfBone(veh.getBoneIndexByName("boot"));
- const offset = {
- 'x': trunkPos.x - (pos.x + (1 * veh.getForwardVector().x)),
- 'y': trunkPos.y - (pos.y + (1 * veh.getForwardVector().y)),
- 'z': 0.5
- }
- // Set our defaults
- const xRot = 0;
- const yRot = 0;
- const zRot = 0;
- const p9 = true;
- const softPin = false;
- const collision = true;
- const isPed = true;
- const vertexInt = 0;
- const fixedRot = true;
- player.attachTo(veh.handle, boneIndex,
- 0, 0, 0,
- xRot, yRot, zRot,
- p9, softPin, collision, isPed,
- vertexInt, fixedRot
- );
- player.freezePosition(true);
- player.setCollision(false);
- player.setInvincible(true);
- });
- mp.events.add('OutTrunk', function (player, veh) {
- player.freezePosition(false);
- player.setCollision(true);
- player.detach(true, false);
- const pos = veh.position;
- const trunkPos = veh.getWorldPositionOfBone(veh.getBoneIndexByName("boot"));
- const dist = mp.game.system.vdist(trunkPos.x, trunkPos.y, trunkPos.z, pos.x, pos.y, pos.z);
- player.position = veh.getOffsetFromInWorldCoords(0, -dist - 1, 0);
- player.setHeading(veh.getHeading());
- player.setInvincible(false);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement