Jump to content

Teleporting w or w/o vehicle facing towards an exact angle


Recommended Posts

Hello there guys, i'm having an issue.
So basically i'm trying to make a command which teleports the player to a specific location, facing towards an exact angle, if the player is in a vehicle, it teleports the vehicle to other coordinates, facing towards other angle.
The problem there is the "heading" thing, i tried so many things to make the vehicle or the player always teleport in a specific angle but it didn't work. Can anyone help me? Here's the code:


mp.events.addCommand('gotoa', (player) => {
    if (player.vehicle) 
        player.vehicle.position = new mp.Vector3(-1033.1522216796875, -2729.705078125, 20.113100051879883, -117.61063385009766);
        player.position = new mp.Vector3(-1037.6630859375, -2737.679443359375, 20.16929054260254, -30.945030212402344);
Link to comment
Share on other sites

Let's start with the fact that Vector3 has only 3 coordinates. X, Y, Z

let vector = new mp.Vector3(Number x, Number y, Number z)

Now to how to set the rotation coordinates

player.heading = your value;

vehicle.rotation = new mp.Vector3(0, 0, 90);


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
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...