pawn Код:
public Velocimetro()
{
new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
new Float:PlayerSpeedDistance,value;
new Float:Speedo_HP;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
GetPlayerVehicleID(i);
GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(Speedo_X,SavePlayerPosV[i][sX])),2)+floatpower(floatabs(floatsub(Speedo_Y,SavePlayerPosV[i][sY])),2)+floatpower(floatabs(floatsub(Speedo_Z,SavePlayerPosV[i][sZ])),2));
value = floatround(PlayerSpeedDistance * 5000);
new vehicle = GetPlayerVehicleID(i);
new str1[256],str2[256],str3[256],str4[256];
if(SpeedoON[i] == 0)
{
TextDrawShowForPlayer(i, box[i]);
//TextDrawShowForPlayer(i, tacho[i]);
TextDrawShowForPlayer(i, fahrzeug[i]);
TextDrawShowForPlayer(i, kmh[i]);
TextDrawShowForPlayer(i, hoehe[i]);
TextDrawShowForPlayer(i, zustand[i]);
TextDrawShowForPlayer(i, url[i]);
SpeedoON[i] = 1;
}
new kmh_anzahl = floatround(value/1600);
format(str1,sizeof(str1),"Veiculo: ~p~%s",vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
TextDrawSetString(fahrzeug[i], str1);
if(kmh_anzahl >= 150)
{
format(str2,sizeof(str2),"KM/H: ~r~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 100)
{
format(str2,sizeof(str2),"KM/H: ~p~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 50)
{
format(str2,sizeof(str2),"KM/H: ~p~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else
{
format(str2,sizeof(str2),"KM/H: ~p~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
format(str3,sizeof(str3),"Combustivel: ~p~%d%", Gas[vehicle]);
TextDrawSetString(hoehe[i], str3);
if(Speedo_HP >= 551)
{
format(str4,sizeof(str4),"Lataria: ~p~%0.0f%%", Speedo_HP/10);
TextDrawSetString(zustand[i], str4);
}
else if(Speedo_HP >= 361)
{
format(str4,sizeof(str4),"Lataria: ~p~%0.0f%%", Speedo_HP/10);
TextDrawSetString(zustand[i], str4);
}
else
{
format(str4,sizeof(str4),"Lataria: ~p~%0.0f%%", Speedo_HP/10);
TextDrawSetString(zustand[i], str4);
}