Hallo liebe Breadfish Community ich habe ein Problem meine TextDraws werden nicht angezeigt und wen manchmal nur 1 ich zeige euch mal das filterscript ihr könnt auch noch was ergansen wäre super net.
Hier die Paste:
#include <a_samp>
#pragma tabsize 0
new Float:X1[MAX_PLAYERS],Float:Y1[MAX_PLAYERS],Float:Z1[MAX_PLAYERS];
new Float:X2[MAX_PLAYERS],Float:Y2[MAX_PLAYERS],Float:Z2[MAX_PLAYERS];
new Text:Tacho[MAX_PLAYERS];
new Text:TachoName;
new Text:TachoGeschwindigkeit;
new Text:TachoZustand;
new Text:TachoZustand2;
new Text:TachoFuel;
new Text:TachoFuel2;
forward UpdateTacho();
forward UpdateTacho2(playerid);
#define TACHOTIMER 1000
public OnFilterScriptInit()
{
for( new x= 0;x<MAX_PLAYERS;x++)
{
// Create the textdraws:
Tacho[x] = TextDrawCreate(501.000000, 250.000000, "[ Km/H]");
TextDrawBackgroundColor(Tacho[x], 255);
TextDrawFont(Tacho[x], 1);
TextDrawLetterSize(Tacho[x], 0.500000, 1.000000);
TextDrawColor(Tacho[x], -16776961);
TextDrawSetOutline(Tacho[x], 0);
TextDrawSetProportional(Tacho[x], 1);
TextDrawSetShadow(Tacho[x], 1);
TachoZustand = TextDrawCreate(501.000000, 264.000000, "Zustand:");
TextDrawBackgroundColor(TachoZustand, 255);
TextDrawFont(TachoZustand, 1);
TextDrawLetterSize(TachoZustand, 0.509998, 1.500000);
TextDrawColor(TachoZustand, 65535);
TextDrawSetOutline(TachoZustand, 0);
TextDrawSetProportional(TachoZustand, 1);
TextDrawSetShadow(TachoZustand, 1);
TachoZustand2 = TextDrawCreate(501.000000, 281.000000, "[ 1000 /1000]");
TextDrawBackgroundColor(TachoZustand2, 255);
TextDrawFont(TachoZustand2, 1);
TextDrawLetterSize(TachoZustand2, 0.500000, 1.000000);
TextDrawColor(TachoZustand2, -16776961);
TextDrawSetOutline(TachoZustand2, 0);
TextDrawSetProportional(TachoZustand2, 1);
TextDrawSetShadow(TachoZustand2, 1);
TachoGeschwindigkeit = TextDrawCreate(500.000000, 237.000000, "Geschwindigkeit:");
TextDrawBackgroundColor(TachoGeschwindigkeit, 255);
TextDrawFont(TachoGeschwindigkeit, 1);
TextDrawLetterSize(TachoGeschwindigkeit, 0.500000, 1.299999);
TextDrawColor(TachoGeschwindigkeit, 65535);
TextDrawSetOutline(TachoGeschwindigkeit, 0);
TextDrawSetProportional(TachoGeschwindigkeit, 1);
TextDrawSetShadow(TachoGeschwindigkeit, 1);
TachoFuel = TextDrawCreate(502.000000, 294.000000, "Tank:");
TextDrawBackgroundColor(TachoFuel, 255);
TextDrawFont(TachoFuel, 1);
TextDrawLetterSize(TachoFuel, 0.500000, 1.500000);
TextDrawColor(TachoFuel, 65535);
TextDrawSetOutline(TachoFuel, 0);
TextDrawSetProportional(TachoFuel, 1);
TextDrawSetShadow(TachoFuel, 1);
TachoFuel2 = TextDrawCreate(501.000000, 311.000000, "[ 80 /80 L]");
TextDrawBackgroundColor(TachoFuel2, 255);
TextDrawFont(TachoFuel2, 1);
TextDrawLetterSize(TachoFuel2, 0.500000, 1.000000);
TextDrawColor(TachoFuel2, -16776961);
TextDrawSetOutline(TachoFuel2, 0);
TextDrawSetProportional(TachoFuel2, 1);
TextDrawSetShadow(TachoFuel2, 1);
TachoName = TextDrawCreate(571.000000, 220.000000, "Tacho:");
TextDrawAlignment(TachoName, 2);
TextDrawBackgroundColor(TachoName, 65535);
TextDrawFont(TachoName, 1);
TextDrawLetterSize(TachoName, 0.719999, 1.700000);
TextDrawColor(TachoName, -16776961);
TextDrawSetOutline(TachoName, 1);
TextDrawSetProportional(TachoName, 1);
TextDrawUseBox(TachoName, 1);
TextDrawBoxColor(TachoName, 255);
TextDrawTextSize(TachoName, -8.000000, -150.000000);
}
return 1;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(TachoZustand);
TextDrawDestroy(TachoZustand);
TextDrawHideForAll(TachoZustand2);
TextDrawDestroy(TachoZustand2);
TextDrawHideForAll(TachoGeschwindigkeit);
TextDrawDestroy(TachoGeschwindigkeit);
TextDrawHideForAll(TachoFuel);
TextDrawDestroy(TachoFuel);
TextDrawHideForAll(TachoFuel2);
TextDrawDestroy(TachoFuel2);
TextDrawHideForAll(TachoName);
TextDrawDestroy(TachoName);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
TextDrawShowForPlayer(playerid, TachoZustand);
TextDrawShowForPlayer(playerid, TachoZustand2);
TextDrawShowForPlayer(playerid, TachoGeschwindigkeit);
TextDrawShowForPlayer(playerid, TachoFuel);
TextDrawShowForPlayer(playerid, TachoFuel2);
TextDrawShowForPlayer(playerid, TachoName);
}
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid, TachoZustand);
TextDrawHideForPlayer(playerid, TachoZustand2);
TextDrawHideForPlayer(playerid, TachoGeschwindigkeit);
TextDrawHideForPlayer(playerid, TachoFuel);
TextDrawHideForPlayer(playerid, TachoFuel2);
TextDrawHideForPlayer(playerid, TachoName);
}
return 1;
}
public OnPlayerConnect(playerid)
{
SetTimerEx("UpdateTacho2",TACHOTIMER,1,"i",playerid);
return 1;
}
public UpdateTacho()
{
for(new i = 0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER && !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[50];
format(String,50,"[ %d Km/H]",floatround(Geschwindigkeit));
TextDrawSetString(Tacho[i],String);
GetVehiclePos(GetPlayerVehicleID(i),X2[i],Y2[i],Z2[i]);
TextDrawShowForPlayer(i,Tacho[i]);
TextDrawShowForPlayer(i,TachoFuel);
TextDrawShowForPlayer(i,TachoFuel2);
TextDrawShowForPlayer(i,TachoZustand);
TextDrawShowForPlayer(i,TachoGeschwindigkeit);
TextDrawShowForPlayer(i,TachoName);
}
else
{
TextDrawHideForPlayer(i,TachoName);
TextDrawHideForPlayer(i,TachoGeschwindigkeit);
TextDrawHideForPlayer(i,Tacho[i]);
TextDrawHideForPlayer(i,TachoZustand);
TextDrawHideForPlayer(i,TachoFuel);
TextDrawHideForPlayer(i,TachoFuel2);
}
}
return 1;
}
public UpdateTacho2(playerid)
{
for(new i = 0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i))
{
new String[64];
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
format(String,50,"[ %i /1000]",GetVehicleHealth(veh, health));
TextDrawSetString(TachoZustand2,String);
}
else
{
TextDrawHideForPlayer(i,TachoZustand2);
}
}
return 1;
}