How to:
#1

How do I get the X, Y, Z at the back of a players vehicle?

Thanks!

I have:

pawn Код:
stock GetXYZBehindVehicle(playerid)
{
    new vehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
    new Float:Pos[5];
    GetVehiclePos(GetPlayerVehicleID(playerid), Pos[1], Pos[2], Pos[3]);
    GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[4]);
    switch(vehiclemodel)
    {
        case 400:
        {
            SetPlayerCheckpoint(playerid, Pos[1], Pos[2], Pos[3], 1.0);
        }
    }
    return 1;
}
What do I do from that?

Edit: oops, was supposed to be an edit.
Reply
#2

I'm terrible at math, but I found this.
pawn Код:
stock GetXYBehindPlayer(playerid, &Float:x2, &Float:y2, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x2, y2, a);
    GetPlayerFacingAngle(playerid, a);
    if(GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x2 += (distance * floatsin(-a+180, degrees));
    y2 += (distance * floatcos(-a+180, degrees));
}
Reply
#3

THANK YOU VINCENT!

It worked! :3

<3!
Reply
#4

Vincent, please could you look here? : https://sampforum.blast.hk/showthread.php?tid=346171
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)