03.04.2013, 15:42
Hey, is there any stock for this?
stock PlayerBehindVehicle(playerid)
{
new Float:vX, Float:vY, Float:vZ, Float:vA;
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(VehicleInfo[i][carOwned] == 1)
{
GetVehiclePos(i, vX, vY, vZ);
GetVehicleZAngle(i, vA);
if(vA >= 270 && vA <= 360 && IsPlayerInRangeOfPoint(playerid, 2.0, vX-3.0, vY, vZ))
return i;
if(vA >= 180 && vA <= 270 && IsPlayerInRangeOfPoint(playerid, 2.0, vX, vY-3.0, vZ))
return i;
if(vA >= 90 && vA <= 180 && IsPlayerInRangeOfPoint(playerid, 2.0, vX+3.0, vY, vZ))
return i;
if(vA >= 0 && vA <= 90 && IsPlayerInRangeOfPoint(playerid, 2.0, vX, vY-3.0, vZ))
return i;
}
}
return INVALID_VEHICLE_ID;
}