Need help with GetXYZInrear.
#1

Hi, I'm looking for a function GetXYZInrear. I used ****** and clambered many forums, but never found. I have GetXYInrearOfPlayer, but it does not return Z. If someone has this feature, please share.
P.S. Sorry for bad English
Reply
#2

Probably this plugin is what are you looking for: https://sampforum.blast.hk/showthread.php?tid=120013
Reply
#3

But I think GetXYZInrear will be better, especially since I can not spend a lot of RAM
Reply
#4

You also can use player's current Z position. I don't see any way to get rear Z pos without that plugin.
Reply
#5

This feature exists and I wonder whether it is from someone
Reply
#6

There is no other way. Use that plugin or use the players Z pos
Reply
#7

Too late but:
pawn Код:
stock GetXYZInrear(Float:distance, Float:angle, Float:pitch, &Float:x, &Float:y, &Float:z)
{
    x -= (distance * floatsin(-angle, degrees));
    y -= (distance * floatcos(-angle, degrees));
    z -= (distance * floatsin(pitch, degrees));
}
Sorry for bumping...
Reply
#8

If you want to get the position behind a vehicle, I made this:

pawn Код:
stock GetPosBehindVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:offset=1.0)
{
    new Float:vehicleSize[3], Float:vehiclePos[3];
    GetVehiclePos(vehicleid, vehiclePos[0], vehiclePos[1], vehiclePos[2]);
    GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, vehicleSize[0], vehicleSize[1], vehicleSize[2]);
    GetXYBehindVehicle(vehicleid, vehiclePos[0], vehiclePos[1], (vehicleSize[1]/2)+offset);
    x = vehiclePos[0];
    y = vehiclePos[1];
    z = vehiclePos[2];
    return 1;
}

GetXYBehindVehicle(vehicleid, &Float:q, &Float:w, Float:distance)
{
    new Float:a;
    GetVehiclePos(vehicleid, q, w, a);
    GetVehicleZAngle(vehicleid, a);
    q += (distance * -floatsin(-a, degrees));
    w += (distance * -floatcos(-a, degrees));
}
If you want to get the position behind a PLAYER:

pawn Код:
GetXYBehindPlayer(playerid, &Float:q, &Float:w, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, q, w, a);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    else GetPlayerFacingAngle(playerid, a);
    q += (distance * -floatsin(-a, degrees));
    w += (distance * -floatcos(-a, degrees));
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)