17.03.2015, 17:25
OP show your sv array definition please.
Edit: For starters, few code improvements:
Edit: For starters, few code improvements:
pawn Код:
public Speedometer(playerid) {
GetVehicleVelocity(GetPlayerVehicleID(playerid),sv[0],sv[1],sv[2]); //This function doesn't return a value
sv[3] = floatround((floatsqroot(((sv[0]*sv[0])+(sv[1]*sv[1])+(sv[2]*sv[2]))* 181.5), floatround_round); // If sv[3] is an integer, your previous code will mess up stuff.
format(fquery,sizeof(fquery),"Vehicle: %s~n~Speed: %i KPH", GetVehicleNameFromModel(GetPlayerVehicleID(playerid)),sv[3]); //Model will be fetched from inside that function
PlayerTextDrawSetString(playerid,Speedo[playerid],fquery);
return 1;
}
//and
stock GetVehicleNameFromModel(modelid)
{
return VehicleNames[GetVehicleModel(modelid) - 400];
}