[Help] New GetXYZInFrontOfPlayer
#10

Do not change x or y, this will just move the starting point (player position) a bit. Change a like i explained:

pawn Код:
forward GetXYInFrontOfPlayer2(playerid, &Float, &Float:y, Float:distance, Float:angle);
public GetXYInFrontOfPlayer2(playerid, &Float, &Float:y, Float:distance, Float:angle) {
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    a += angle;
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
angle=0 : front of the player
angle>0 : degrees to the left side
angle<0 : right side (maybe the other way round, test it)
Reply


Messages In This Thread
[Help] New GetXYZInFrontOfPlayer - by Bogdanovic - 24.10.2010, 17:22
Re: [Help] New GetXYZInFrontOfPlayer - by Grim_ - 24.10.2010, 17:25
Re: [Help] New GetXYZInFrontOfPlayer - by Bogdanovic - 24.10.2010, 17:37
Re: [Help] New GetXYZInFrontOfPlayer - by Mauzen - 24.10.2010, 18:48
Re: [Help] New GetXYZInFrontOfPlayer - by Bogdanovic - 24.10.2010, 19:00
Re: [Help] New GetXYZInFrontOfPlayer - by Bogdanovic - 24.10.2010, 19:55
Re: [Help] New GetXYZInFrontOfPlayer - by Hiddos - 24.10.2010, 20:01
Re: [Help] New GetXYZInFrontOfPlayer - by Bogdanovic - 24.10.2010, 20:37
Re: [Help] New GetXYZInFrontOfPlayer - by Bogdanovic - 24.10.2010, 20:54
Re: [Help] New GetXYZInFrontOfPlayer - by Mauzen - 24.10.2010, 22:33

Forum Jump:


Users browsing this thread: 1 Guest(s)