Tacho Bug

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Also, mein Tacho(Textdraw) wird angezeigt und sachen wie, schaden, motor(an/aus), etc. wird richtig angezeigt nur die geschwindigkeit nicht. Sie springt auf einen Wert und ist danach sofort wieder 0. Woran liegt das?


    Code:


    Textdraw:

    Spoiler anzeigen
    new Text:TachoBox;
    new Text:TachoVar[MAX_PLAYERS];//TachoMotor

    Spoiler anzeigen
    OnGameModeInit()
    {
    /****************************Tacho****************************/
    //Tacho Textdraw - Box//
    TachoBox = TextDrawCreate(495.333312, 438.051116, "usebox");
    TextDrawLetterSize(TachoBox, 0.000000, -6.621851);
    TextDrawTextSize(TachoBox, 621.111083, 0.000000);
    TextDrawAlignment(TachoBox, 1);
    TextDrawColor(TachoBox, 0);
    TextDrawUseBox(TachoBox, true);
    TextDrawBoxColor(TachoBox, 102);
    TextDrawSetShadow(TachoBox, 0);
    TextDrawSetOutline(TachoBox, 0);
    TextDrawFont(TachoBox, 0);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    //Tacho Textdraw - Motor//
    TachoVar[i] = TextDrawCreate(496.888763, 382.791198, "Motor: ---~n~Km / H: ---~n~Schaden: ---~n~Liter: ---~n~");
    TextDrawLetterSize(TachoVar[i], 0.401111, 1.236621);
    TextDrawAlignment(TachoVar[i], 1);
    TextDrawColor(TachoVar[i], -1);
    TextDrawSetShadow(TachoVar[i], 0);
    TextDrawSetOutline(TachoVar[i], 1);
    TextDrawBackgroundColor(TachoVar[i], 51);
    TextDrawFont(TachoVar[i], 1);
    TextDrawSetProportional(TachoVar[i], 1);
    SetTimer("UpdateTacho",TACHOTIMER,1);
    }
    /******************TEXTDRAW ENDE******************/
    }

    Funktion:
    Spoiler anzeigen
    public UpdateTacho()
    {
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && !IsPlayerNPC(i))
    {
    new Float:Strecke, Float:Geschwindigkeit, Float:vhdhealth, vhd;
    new String[264], MotorAnAus[5];
    new engine,doors,bonnet,boot,objective,lights,alarm;
    vhd = GetPlayerVehicleID(i);
    GetVehicleParamsEx(vhd,engine,lights,alarm,doors,bonnet,boot,objective);
    GetVehicleHealth(vhd,vhdhealth);
    GetVehiclePos(vhd,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;
    if(engine == 1){MotorAnAus = "An";}
    else{MotorAnAus = "Aus";}
    format(String,sizeof String,"Motor: %s~n~Km/H: %d~n~Schaden: %d~n~Tank: %i",MotorAnAus,floatround(Geschwindigkeit),floatround(vhdhealth),-1);
    TextDrawSetString(TachoVar[i],String);//changen
    GetVehiclePos(vhd,X2[i],Y2[i],Z2[i]);
    TextDrawShowForPlayer(i,TachoBox);
    TextDrawShowForPlayer(i,TachoVar[i]);
    }
    else
    {
    TextDrawHideForPlayer(i,TachoBox);
    TextDrawHideForPlayer(i,TachoVar[i]);
    }
    }
    return 1;
    }


    xXSeXyBreaDXx -> BREAD. -> [LoG]Bread -> Bread

  • Der Timer ist ganz unten bei Textdraw drinn ^^



    #define TACHOTIMER 1000


    /**************************************/


    SetTimer("UpdateTacho",TACHOTIMER,1);
    E: Hat den Tacho falsch gesetzt(in der for schleife)


    xXSeXyBreaDXx -> BREAD. -> [LoG]Bread -> Bread

    Einmal editiert, zuletzt von Bread ()