Jo Leute,
habe versucht mein Tachosystem zu erneueren, aber
wenn ich InGame bin aktualisiert sich der Tacho alls paar Sekunden nur, obwohl der Timer auf
100 Millisekunden steht.
Hier der Code:
Function SpeedoTimer()
{
for(new i=0; i<SLOTS; i++)
{
new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
new Float:Speedo_HP;
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
GetPlayerVehicleID(i);
GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
new str1[256],str2[256],str3[256],str4[256];
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
new veh = GetPlayerVehicleID(i);
GetVehicleVelocity(veh, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*120.0; // 136.666667 = kmph // 85.4166672= mph
final_speed_int = floatround(final_speed,floatround_round);
new kmh_anzahl = final_speed_int;
format(str1,sizeof(str1),"~r~Fahrzeug: ~w~%s",VehicleName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
TextDrawSetString(fahrzeug[i], str1);
format(str2,sizeof(str2),"~b~KM/H: ~w~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
new vehicleid = GetPlayerVehicleID(i);
format(str3,sizeof(str3),"~b~Tank: ~w~%d / %d Liter", Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)));
TextDrawSetString(hoehe[i], str3);
format(str4,sizeof(str4),"~b~Zustand: ~w~%.2f", Speedo_HP);
TextDrawSetString(zustand[i], str4);
TextDrawShowForPlayer(i, box[i]); TextDrawShowForPlayer(i, fahrzeug[i]); TextDrawShowForPlayer(i, kmh[i]);
TextDrawShowForPlayer(i, hoehe[i]); TextDrawShowForPlayer(i, zustand[i]);
}
SavePlayerPos[i][sX] = Speedo_X, SavePlayerPos[i][sY] = Speedo_Y, SavePlayerPos[i][sZ] = Speedo_Z;
}
for(new i=0; i<SLOTS; i++)
{
if(!IsPlayerInAnyVehicle(i))
{
TextDrawHideForPlayer(i, box[i]); TextDrawHideForPlayer(i, fahrzeug[i]); TextDrawHideForPlayer(i, kmh[i]);
TextDrawHideForPlayer(i, hoehe[i]); TextDrawHideForPlayer(i, zustand[i]);
}
}
}
Und der Timer:
checkspeedtimer = SetTimer("SpeedoTimer",100,1);
Bitte helft mir
MfG Larso99