01.02.2014, 09:08
Hello Guys,
I need some help, since i am really frustrated with this Speedometer.
The Problem is that the Speedometer multiplies it self and it wont stop. Plus its kinda Rough with the Speed. Does any1 know, how to fix this?
Regards
[GM]The_Don
I need some help, since i am really frustrated with this Speedometer.
Quote:
public UpdateSpeed() { new Float,Float:y,Float:z; new Float:distance,value,string[256]; new Float:health; /*for(new i=0; i<TACHOSLOTS; i++) { if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) { TextDrawDestroy(Speedo[i]); } }*/ for(new i=0; i<TACHOSLOTS; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInAnyVehicle(i)) { new Vi = GetPlayerVehicleID(i); GetPlayerPos(i, x, y, z); GetVehicleHealth(GetPlayerVehicleID(i), health); distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePla yerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2)); value = floatround(distance * 5000); if(UpdateSeconds > 1) { value = floatround(value / UpdateSeconds); } if(Petrol[Vi] >= 90) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~IIII~g~III~n~~y~Geschwindigk eit:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s ~n~~g~Fahrzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 80) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~IIII~g~II~n~~y~Geschwindigke it:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 70) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~IIII~g~I~n~~y~Geschwindigkei t:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 60) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~IIII~n~~y~Geschwindigkeit:~w ~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 50) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~III~n~~y~Geschwindigkeit:~w~ %d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 40) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~II~n~~y~Geschwindigkeit:~w~% d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 30) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~y~I~n~~y~Geschwindigkeit:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 20) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~III~n~~y~Geschwindigkeit:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~b~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 10) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~II~n~~y~Geschwindigkeit:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } else if(Petrol[Vi] >= 5) { format(string,sizeof(string),"~y~Laufleistung:~w~% d KM~n~~r~Tank:~r~I~n~~y~Geschwindigkeit:~w~%d Km/h~n~~b~Besitzer:~w~%s~n~~p~Fahrzeug:~w~%s~n~~g~Fah rzeug HP:~w~%.f %",CarInfo[Vi][cKMStand],floatround(value/1100),CarInfo[Vi][cOwner],CarName[GetVehicleModel(Vi)-400],health/10); } Speedo[i] = TextDrawCreate(320.00, 380.00, string); TextDrawAlignment(Speedo[i],2); TextDrawBackgroundColor(Speedo[i],0x000000ff); TextDrawFont(Speedo[i],1); TextDrawLetterSize(Speedo[i],0.399999,1.200000); TextDrawColor(Speedo[i],0xffffffff); TextDrawSetOutline(Speedo[i],1); TextDrawSetString(Speedo[i], string); TextDrawShowForPlayer (i, Speedo[i]); //TextDrawSetString(Speedo[i], string); }else{ TextDrawHideForPlayer(i,Speedo[i]); TextDrawDestroy(Speedo[i]); //TextDrawShowForPlayer(i,Werbung); } } SavePlayerPos[i][LastX] = x; SavePlayerPos[i][LastY] = y; SavePlayerPos[i][LastZ] = z; } } |
Regards
[GM]The_Don