Sry für ein erneutes Thema.
Mein Tacho buggt. wenn ich in einem Fahrzeug bin und voll Gas gebe dann zeigt der nur 5 km/h an oder so;(
public OnPlayerUpdate(playerid)
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
{
new string[125];
if(Tank[vehicleid] < 10) format(string,sizeof string,"~w~Tank: ~r~%i",Tank[vehicleid]);
else if(Tank[vehicleid] < 30) format(string,sizeof string,"~w~Tank: ~y~%i",Tank[vehicleid]);
else if(Tank[vehicleid] <= 100) format(string,sizeof string,"~w~Tank: ~g~%i",Tank[vehicleid]);
TextDrawSetString(Tankanzeige[playerid],string);
}
}
else
{
TextDrawSetString(Tankanzeige[playerid], " ");
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && !IsPlayerNPC(i))
{
new Float:Strecke, Float:Geschwindigkeit;
GetVehiclePos(GetPlayerVehicleID(i), X1[i], Y1[i], Z1[i]);
Strecke = floatsqroot(floatpower(floatabs(floatsub(X1[i],X2[i])),2)+floatpower(floatabs(floatsub(Y1[i],Y2[i])),2)+floatpower(floatabs(floatsub(Z1[i],Z2[i])),2));
Geschwindigkeit = (Strecke / (TACHOTIMER/1000)) * 3.6;
new String[64];
format(String,sizeof(String),"~w~Km/h: %d",floatround(Geschwindigkeit));
TextDrawSetString(Tacho[i],String);
GetVehiclePos(GetPlayerVehicleID(i), X2[i], Y2[i], Z2[i]);
TextDrawShowForPlayer(i,Tacho[i]);
}
else
{
TextDrawHideForPlayer(i,Tacho[i]);
}
}
return 1;
}
MFG