Spawn in front of vehicle
#1

How I can spawn in front of vehicle if I have coordinates of it (x, y, z)?
Thanks in advanced.
Reply
#2

search 'GetXYInFrontOFPlayer'
Reply
#3

As said by cool, use GetXYInFrontOfPlayer function to achieve it.
pawn Код:
Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    else GetPlayerFacingAngle(playerid, a);
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
    return a;
}
Reply
#4

Thanks both +REP
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)