26.06.2013, 12:59
I think this should do it:
The thing is you didn't use "i" at all, only in "VehicleNumberPlate[i]", but as far as I am concerned, the vehicle's ID the code is looking for is "pcv", so try it now.
pawn Код:
forward UpdateDashCam(playerid);
public UpdateDashCam(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0x1;
if(IsACopCar(playerid))
{
new pcv = GetNearestVehicle(playerid, dcam_Distance);
new pvid = GetPlayerVehicleID(playerid);
new Float:vPos[3];
GetVehiclePos(pvid, vPos[0], vPos[1], vPos[2]);
new Float:distance = GetVehicleDistanceFromPoint(pcv, vPos[0], vPos[1], vPos[2]);
new Float:speed = GetVehicleSpeed(pcv, 0);
new string[40];
if(floatround(distance) <= dcam_Distance - 5.0)
{
format(string, sizeof(string), "P %s~n~S %d kmph~n~D %d m", VehicleNumberPlate[pcv], floatround(speed), floatround(distance));
}
else format(string, sizeof(string), "P N/A~n~S N/A kmph~n~D N/A m");
PlayerTextDrawSetString(playerid, pDashCam[playerid], string);
}
return 0x1;
}

