2021-07-30, 04:41 AM
PHP Code:
stock Float:GetPosInFrontOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
? ? new Float:a;
? ? GetVehiclePos(vehicleid, x, y, a);
? ? GetVehicleZAngle(vehicleid, a);
? ? x = (distance * floatsin(-a, degrees));
? ? y = (distance * floatcos(-a, degrees));
? ? return a;
}
PHP Code:
new Float:Pos[3];
GetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
SetPlayerCameraLookAt(playerid,Pos[0], Pos[1], Pos[2]);
GetPosInFrontOfVehicle(GetPlayerVehicleID(playerid), Pos[0], Pos[1], 7.0);//If you want the camera to stay behind the vehicle, just put a negative value, for example: -7.0
SetPlayerCameraPos(playerid, Pos[0], Pos[1], Pos[2].0);//Here you adjust the height of the camera, example: .0