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; } } |
//onplayerentervehicle
Speedo[playerid] = TextDrawCreate(320.00, 380.00, "0");
TextDrawAlignment(Speedo[playerid],2);
TextDrawBackgroundColor(Speedo[playerid],0x000000ff);
TextDrawFont(Speedo[playerid],1);
TextDrawLetterSize(Speedo[playerid],0.399999,1.200000);
TextDrawColor(Speedo[playerid],0xffffffff);
TextDrawSetOutline(Speedo[playerid],1);
TextDrawSetString(Speedo[playerid], string);
TextDrawShowForPlayer(playerid, Speedo[playerid]);
//onplayerleavevehicle
TextDrawDestroy(Speedo[playerid]);
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))
{
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);
}
TextDrawSetString(Speedo[i], string);
}
}
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
}
}