[Solved] Player facing vehicle
#4

well you can check if there are any cars in the 100m circle in 50m front of the player and he should be looking at them

these might be handy
pawn Код:
stock Float:GetPosInFrontOfPlayer(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;
}
and
pawn Код:
stock GetStartDirection(Float:angle) { // by Noobanatior
    new direction[16];
    if      (angle > 22.5 && angle <= 67.5) direction = "North East";
    else if (angle > 67.5 && angle <= 112.5) direction = "East";
    else if (angle > 112.5 && angle <= 157.5) direction = "South East";
    else if (angle > 157.5 && angle <= 202.5) direction = "South";
    else if (angle > 202.5 && angle <= 247.5) direction = "South West";
    else if (angle > 247.5 && angle <= 292.5) direction = "West";
    else if (angle > 247.5 && angle <= 337.5) direction = "North West";
    else direction = "North";
    return direction;
}
Reply


Messages In This Thread
[Solved] Player facing vehicle - by Faith - 05.06.2010, 22:27
Re: Player facing vehicle - by (SF)Noobanatior - 05.06.2010, 22:34
Re: Player facing vehicle - by Faith - 05.06.2010, 22:36
Re: Player facing vehicle - by (SF)Noobanatior - 05.06.2010, 22:55
Re: Player facing vehicle - by (SF)Noobanatior - 06.06.2010, 00:26
Re: Player facing vehicle - by Faith - 07.06.2010, 13:50

Forum Jump:


Users browsing this thread: 1 Guest(s)