Tempomat steigert KM-Stand schnell

  • Tempomat steigert KM-Stand schnell

    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:

    Quellcode

    1. CALLBACK:SpeedTimer(playerid)
    2. {
    3. new textdraw[500], string[128], vid = GetPlayerVehicleID(playerid), mod = GetVehicleModel(vid), engine, light, alarm, doors, bonnet, boot, objective;
    4. GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
    5. if (!IsPlayerOnline(playerid))
    6. {
    7. KillTimer(TachoTimer[playerid]);
    8. PlayerTextDrawHide(playerid, Tacho[playerid]);
    9. return 1;
    10. }
    11. if (!IsPlayerInAnyVehicle(playerid))
    12. {
    13. KillTimer(TachoTimer[playerid]);
    14. PlayerTextDrawHide(playerid, Tacho[playerid]);
    15. return 1;
    16. }
    17. PlayerTextDrawShow(playerid, Tacho[playerid]);
    18. if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER && engine == VEHICLE_PARAMS_ON)
    19. {
    20. new Float:pos[3], Float:output;
    21. GetVehiclePos(vid, pos[0], pos[1], pos[2]);
    22. 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));
    23. Vehicles[vid][vehicleKm] += output;
    24. Vehicles[vid][vLastX] = pos[0];
    25. Vehicles[vid][vLastY] = pos[1];
    26. Vehicles[vid][vLastZ] = pos[2];
    27. }
    28. format(string, sizeof(string), "~b~Fahrzeug~w~: %s~n~", VehNames[(mod-400)]);
    29. strcat(textdraw, string);
    30. if (GetVehicleZustand(vid) > 49)
    31. {
    32. format(string, sizeof(string), "~b~Zustand~w~: %d%~n~", GetVehicleZustand(vid));
    33. strcat(textdraw, string);
    34. }
    35. else
    36. {
    37. format(string, sizeof(string), "~b~Zustand~w~: ~r~%d%~n~", GetVehicleZustand(vid));
    38. strcat(textdraw, string);
    39. }
    40. format(string, sizeof(string), "~b~Geschwindigkeit~w~: %d km/h~n~", GetPlayerKmh(playerid));
    41. strcat(textdraw, string);
    42. format(string, sizeof(string), "~b~Kilometer~w~: %.2f", (Vehicles[vid][vehicleKm]/1000));
    43. strcat(textdraw, string);
    44. PlayerTextDrawSetString(playerid, Tacho[playerid], textdraw);
    45. return 1;
    46. }
    Alles anzeigen