Problem In X Y Z In Front Of Player
#1

pawn Код:
#include <a_samp>
#include <QuaternionStuff>
#include <zcmd>
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}

GetXYZInFrontOfPlayer(playerid, &Float:x, &Float:y, &Float:z, Float:distance)
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        new Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        x += (distance * floatsin(-a, degrees));
        y += (distance * floatcos(-a, degrees));
    }else{
        new Float:qw,Float:qx,Float:qy,Float:qz,Float:rx,Float:ry,Float:rz,Float:a;
        GetVehicleRotationQuat(GetPlayerVehicleID(playerid),qw,qx,qy,qz);
        QuatToEuler(rx,ry,rz,qw,qx,qy,qz);
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
        GetPlayerPos(playerid, x, y, z);
        new Float:dist2,Float:dist3;
        dist2 = (floatcos(-rx, degrees) * distance);
        dist3 = (floatsin(-rx, degrees) * distance);
        GetXYInFrontOfPlayer(playerid,x,y,dist2);
        z += dist3;

    }
}
Now That Doesn't Work In All Cases of rx i dunno why can anybody help me ??
Reply


Messages In This Thread
Problem In X Y Z In Front Of Player - by Opah - 16.12.2013, 18:46
Re: Problem In X Y Z In Front Of Player - by Chadi - 16.12.2013, 19:07
Re: Problem In X Y Z In Front Of Player - by Opah - 16.12.2013, 19:53
Re: Problem In X Y Z In Front Of Player - by Opah - 20.12.2013, 19:43

Forum Jump:


Users browsing this thread: 3 Guest(s)