Hab da seit Monaten 'n kleines Problem, was ich einfach nicht gefixt bekomme.
Der Kilometerstand der Fahrzeuge steigert sich, egal ob das Fahrzeug steht oder fährt, mit ner rasanten Geschwindigkeit.
Sprich in einer Sekunde rechnet er 3 KM oder so dazu. Weiß nicht, wie ich das fixxen kann. Hier:
Code
CALLBACK:SpeedTimer(playerid)
{
new textdraw[500], string[128], vid = GetPlayerVehicleID(playerid), mod = GetVehicleModel(vid), engine, light, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
if (!IsPlayerOnline(playerid))
{
KillTimer(TachoTimer[playerid]);
PlayerTextDrawHide(playerid, Tacho[playerid]);
return 1;
}
if (!IsPlayerInAnyVehicle(playerid))
{
KillTimer(TachoTimer[playerid]);
PlayerTextDrawHide(playerid, Tacho[playerid]);
return 1;
}
PlayerTextDrawShow(playerid, Tacho[playerid]);
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER && engine == VEHICLE_PARAMS_ON)
{
new Float:pos[3], Float:output;
GetVehiclePos(vid, pos[0], pos[1], pos[2]);
output = floatsqroot(floatpower(floatabs(floatsub(pos[1], Vehicles[vid][vLastX])), 2) + floatpower(floatabs(floatsub(pos[1], Vehicles[vid][vLastY])), 2) + floatpower(floatabs(floatsub(pos[2], Vehicles[vid][vLastZ])), 2));
Vehicles[vid][vehicleKm] += output;
Vehicles[vid][vLastX] = pos[0];
Vehicles[vid][vLastY] = pos[1];
Vehicles[vid][vLastZ] = pos[2];
}
format(string, sizeof(string), "~b~Fahrzeug~w~: %s~n~", VehNames[(mod-400)]);
strcat(textdraw, string);
if (GetVehicleZustand(vid) > 49)
{
format(string, sizeof(string), "~b~Zustand~w~: %d%~n~", GetVehicleZustand(vid));
strcat(textdraw, string);
}
else
{
format(string, sizeof(string), "~b~Zustand~w~: ~r~%d%~n~", GetVehicleZustand(vid));
strcat(textdraw, string);
}
format(string, sizeof(string), "~b~Geschwindigkeit~w~: %d km/h~n~", GetPlayerKmh(playerid));
strcat(textdraw, string);
format(string, sizeof(string), "~b~Kilometer~w~: %.2f", (Vehicles[vid][vehicleKm]/1000));
strcat(textdraw, string);
PlayerTextDrawSetString(playerid, Tacho[playerid], textdraw);
return 1;
}
Alles anzeigen