Huhu,
ich bins mal wieder
Ich habe gestern mit Textdraws gearbeitet, so.
Nun steht wenn man nicht im Auto ist, und wenn man im Auto ist KM/H:
Wenn man dann in ein Auto einsteigt überlappt sich das ;/
Bei OnGameModeInit
for(new i=0; i<SLOTS; i++)
{
kmh[i] = TextDrawCreate(519.000000, 362.500000, "KM/H:");//519.000000, 362.500000
TextDrawBackgroundColor(kmh[i], 255);
TextDrawFont(kmh[i], 3);
TextDrawLetterSize(kmh[i], 0.440000, 0.89999);
TextDrawColor(kmh[i], COLOR_WHITE);
TextDrawSetOutline(kmh[i], 0);
TextDrawSetProportional(kmh[i], 1);
TextDrawSetShadow(kmh[i], 1);
TextDrawTextSize(kmh[i], 630.000000, 11.000000);
TextDrawUseBox(kmh[i],1);
TextDrawBoxColor(kmh[i],842150450);
TextDrawBackgroundColor(kmh[i], 255);
hoehe[i] = TextDrawCreate(519.000000, 374.000000, "Tank:");
TextDrawBackgroundColor(hoehe[i], 255);
TextDrawFont(hoehe[i], 3);
TextDrawLetterSize(hoehe[i], 0.440000, 0.89999);
TextDrawColor(hoehe[i], COLOR_WHITE);
TextDrawSetOutline(hoehe[i], 0);
TextDrawSetProportional(hoehe[i], 1);
TextDrawSetShadow(hoehe[i], 1);
TextDrawTextSize(hoehe[i], 630.000000, 11.000000);
TextDrawUseBox(hoehe[i],1);
TextDrawBoxColor(hoehe[i],842150450);
TextDrawBackgroundColor(hoehe[i], 255);
carleben[i] = TextDrawCreate(519.000000, 386.000000, "Fahrzeugs HP:");
TextDrawBackgroundColor(carleben[i], 255);
TextDrawFont(carleben[i], 3);
TextDrawLetterSize(carleben[i], 0.440000, 0.89999);
TextDrawColor(carleben[i], COLOR_WHITE);
TextDrawSetOutline(carleben[i], 0);
TextDrawSetProportional(carleben[i], 1);
TextDrawSetShadow(carleben[i], 1);
TextDrawTextSize(carleben[i], 630.000000, 11.000000);
TextDrawUseBox(carleben[i],1);
TextDrawBoxColor(carleben[i],842150450);
TextDrawBackgroundColor(carleben[i], 255);
tankart[i] = TextDrawCreate(519.000000, 343.000000, "Tankart:");
TextDrawBackgroundColor(tankart[i], 255);
TextDrawFont(tankart[i], 3);
TextDrawLetterSize(tankart[i], 0.440000, 0.89999);
TextDrawColor(tankart[i], COLOR_WHITE);
TextDrawSetOutline(tankart[i], 0);
TextDrawSetProportional(tankart[i], 1);
TextDrawSetShadow(tankart[i], 1);
TextDrawTextSize(tankart[i], 630.000000, 11.000000);
TextDrawUseBox(tankart[i],1);
TextDrawBoxColor(tankart[i],842150450);
TextDrawBackgroundColor(tankart[i], 255);
Bei OnPlayerVehicleSpawn
public VehStateCheck(playerid)
{
new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
new Float:Speedo_HP;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
GetPlayerVehicleID(i);
GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
new veh = GetPlayerVehicleID(i);
new str1[128],str2[128],str3[128],str4[128],str5[128];
if(SpeedoON[i] == 0 && !IsANoTachoVehicle(veh))
{
TextDrawShowForPlayer(i, kmh[i]); TextDrawShowForPlayer(i, hoehe[i]); TextDrawShowForPlayer(i, carleben[i]); TextDrawShowForPlayer(i, tankart[i]);
SpeedoON[i] = 1;
}
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
GetVehicleVelocity(veh, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667; // 136.666667 = kmph // 85.4166672= mph
final_speed_int = floatround(final_speed,floatround_round);
new kmh_anzahl = final_speed_int;
format(str1,sizeof(str1),"Fahrzeug: ~y~%s",VehicleName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
if(kmh_anzahl >= 150)
{
format(str2,sizeof(str2),"km / h: ~g~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 90)
{
format(str2,sizeof(str2),"km / h: ~g~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 40)
{
format(str2,sizeof(str2),"km / h: ~g~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else
{
format(str2,sizeof(str2),"km / h: ~g~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
new vehicleid = GetPlayerVehicleID(i);
format(str3,sizeof(str3),"Tank: ~r~%d/%d", Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)));
TextDrawSetString(hoehe[i], str3);
if(Speedo_HP >= 551)
{
format(str4,sizeof(str4),"Zustand: ~g~%.2f", Speedo_HP);
TextDrawSetString(carleben[i], str4);
}
else if(Speedo_HP >= 361)
{
format(str4,sizeof(str4),"Zustand: ~y~%.2f", Speedo_HP);
TextDrawSetString(carleben[i], str4);
}
else
{
format(str4,sizeof(str4),"Zustand: ~r~%.2f", Speedo_HP);
TextDrawSetString(carleben[i], str4);
}
if(PlayerInfo[i][ptankart] == 1)
{
format(str5,sizeof(str5),"Tankart: Diesel");
TextDrawSetString(tankart[i],str5);
}
if(PlayerInfo[i][ptankart] == 2)
{
format(str5,sizeof(str5),"Tankart: Benzin");
TextDrawSetString(tankart[i],str5);
}
if(PlayerInfo[i][ptankart] == 3)
{
format(str5,sizeof(str5),"Tankart: Biogas");
TextDrawSetString(tankart[i],str5);
}
if(PlayerInfo[i][ptankart] == 4)
{
format(str5,sizeof(str5),"Tankart: Kerosin");
TextDrawSetString(tankart[i],str5);
}
}
}
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i))
{
new veh = GetPlayerVehicleID(i);
if(!IsPlayerInAnyVehicle(i) && !IsANoTachoVehicle(veh))
{
TextDrawHideForPlayer(i, kmh[i]); TextDrawHideForPlayer(i, hoehe[i]); TextDrawHideForPlayer(i, carleben[i]); TextDrawHideForPlayer(i,tankart[i]);
SpeedoON[i] = 0;
}
}
}
}