Problem mit Tanksystem und Tacho

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
  • Guten Morgen,


    Ich habe vorhin einen neuen Tacho entworfen. Nur weiß ich jz nicht genau wie ich das mit dem Tanksystem verbinden kann.


    Also im Tacho steht halt Tank 100% und nach 2 -3 Minuten steht da 0%. auch wenn ich das Fahrzeug tanke wird da immnoch 0& Tank angezeigt. Also wie bekomme ich das hin das mein Tanksystem und mein Tacho zusammen arbeiten.



    MfG


  • Ohne Code nix los?
    Updatest du nach dem Tanken die Anzeige oder benutzt du ein Timer?


  • Ohne Code nix los?
    Updatest du nach dem Tanken die Anzeige oder benutzt du ein Timer?











    //Defines
    #define SpeedoTime 150
    new PlayerText:Z0;
    new PlayerText:Z160;
    new PlayerText:Z40;
    new PlayerText:Z120;
    new PlayerText:Z80;
    new PlayerText:NadelMitte;
    new PlayerText:Nadel;
    new PlayerText:TankAnzeige;
    new PlayerText:SpeedAnzeige;
    new PlayerText:ZustandsAnzeige;
    new PlayerText:SpeedoHintergrund;
    new PlayerText:FahrzeugNameAnzeige;
    //Speedo
    Z0 = CreatePlayerTextDraw(playerid, 520.000000, 400.000000, "0");
    PlayerTextDrawBackgroundColor(playerid, Z0, 65535);
    PlayerTextDrawLetterSize(playerid, Z0, 0.649999, 3.100000);
    PlayerTextDrawColor(playerid, Z0, -1);
    PlayerTextDrawSetOutline(playerid, Z0, 1);
    Z160 = CreatePlayerTextDraw(playerid, 589.000000, 402.000000, "160");
    PlayerTextDrawBackgroundColor(playerid, Z160, 65535);
    PlayerTextDrawLetterSize(playerid, Z160, 0.500000, 2.799999);
    PlayerTextDrawColor(playerid, Z160, -1);
    PlayerTextDrawSetOutline(playerid, Z160, 1);
    Z40 = CreatePlayerTextDraw(playerid, 526.000000, 380.000000, "40");
    PlayerTextDrawBackgroundColor(playerid, Z40, 65535);
    PlayerTextDrawLetterSize(playerid, Z40, 0.509999, 2.200000);
    PlayerTextDrawColor(playerid, Z40, -1);
    PlayerTextDrawSetOutline(playerid, Z40, 1);
    Z120 = CreatePlayerTextDraw(playerid, 574.000000, 379.000000, "120");
    PlayerTextDrawBackgroundColor(playerid, Z120, 65535);
    PlayerTextDrawLetterSize(playerid, Z120, 0.509999, 2.200000);
    PlayerTextDrawColor(playerid, Z120, -1);
    PlayerTextDrawSetOutline(playerid, Z120, 1);
    Z80 = CreatePlayerTextDraw(playerid, 551.000000, 362.000000, "80");
    PlayerTextDrawBackgroundColor(playerid, Z80, 65535);
    PlayerTextDrawLetterSize(playerid, Z80, 0.500000, 2.799999);
    PlayerTextDrawColor(playerid, Z80, -1);
    PlayerTextDrawSetOutline(playerid, Z80, 1);
    NadelMitte = CreatePlayerTextDraw(playerid, 558.000000, 402.000000, "0");
    PlayerTextDrawLetterSize(playerid, NadelMitte, 0.599999, 2.100000);
    PlayerTextDrawColor(playerid, NadelMitte, -16776961);
    PlayerTextDrawSetOutline(playerid, NadelMitte, 1);
    Nadel = CreatePlayerTextDraw(playerid, 547.000000, 406.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    TankAnzeige = CreatePlayerTextDraw(playerid, 524.000000, 422.000000, "Tank: 100%");
    PlayerTextDrawLetterSize(playerid, TankAnzeige, 0.399999, 2.400000);
    PlayerTextDrawColor(playerid, TankAnzeige, -1);
    PlayerTextDrawSetOutline(playerid, TankAnzeige, 1);
    SpeedAnzeige = CreatePlayerTextDraw(playerid, 505.000000, 359.000000, "km/h 0");
    PlayerTextDrawLetterSize(playerid, SpeedAnzeige, 0.310000, 1.000000);
    PlayerTextDrawColor(playerid, SpeedAnzeige, -1);
    PlayerTextDrawSetOutline(playerid, SpeedAnzeige, 1);
    PlayerTextDrawUseBox(playerid, SpeedAnzeige, 1);
    PlayerTextDrawBoxColor(playerid, SpeedAnzeige, 65535);
    PlayerTextDrawTextSize(playerid, SpeedAnzeige, 544.000000, 0.000000);
    ZustandsAnzeige = CreatePlayerTextDraw(playerid, 583.000000, 359.000000, "Zustand 100%");
    PlayerTextDrawLetterSize(playerid, ZustandsAnzeige, 0.310000, 1.000000);
    PlayerTextDrawColor(playerid, ZustandsAnzeige, -1);
    PlayerTextDrawSetOutline(playerid, ZustandsAnzeige, 1);
    PlayerTextDrawUseBox(playerid, ZustandsAnzeige, 1);
    PlayerTextDrawBoxColor(playerid, ZustandsAnzeige, 65535);
    PlayerTextDrawTextSize(playerid, ZustandsAnzeige, 623.000000, 0.000000);
    SpeedoHintergrund = CreatePlayerTextDraw(playerid, 629.000000, 359.000000, " ");
    PlayerTextDrawLetterSize(playerid, SpeedoHintergrund, 0.310000, 4.499998);
    PlayerTextDrawColor(playerid, SpeedoHintergrund, -1);
    PlayerTextDrawUseBox(playerid, SpeedoHintergrund, 1);
    PlayerTextDrawBoxColor(playerid, SpeedoHintergrund, -926365651);
    PlayerTextDrawTextSize(playerid, SpeedoHintergrund, 499.000000, 0.000000);
    FahrzeugNameAnzeige = CreatePlayerTextDraw(playerid, 563.000000, 336.000000, "XXX");
    PlayerTextDrawAlignment(playerid, FahrzeugNameAnzeige, 2);
    PlayerTextDrawFont(playerid, FahrzeugNameAnzeige, 3);
    PlayerTextDrawLetterSize(playerid, FahrzeugNameAnzeige, 0.500000, 1.800000);
    PlayerTextDrawColor(playerid, FahrzeugNameAnzeige, -1);
    PlayerTextDrawSetOutline(playerid, FahrzeugNameAnzeige, 1);
    PlayerTextDrawUseBox(playerid, FahrzeugNameAnzeige, 1);
    PlayerTextDrawBoxColor(playerid, FahrzeugNameAnzeige, -926365651);
    PlayerTextDrawTextSize(playerid, FahrzeugNameAnzeige, 603.000000, 127.000000);


    //~~~~~~~~~~~~~~~~~~~~ Speedo Unload ~~~~~~~~~~~~~~~~~~//
    PlayerTextDrawHide(playerid, Z0);
    PlayerTextDrawDestroy(playerid, Z0);
    PlayerTextDrawHide(playerid, Z160);
    PlayerTextDrawDestroy(playerid, Z160);
    PlayerTextDrawHide(playerid, Z40);
    PlayerTextDrawDestroy(playerid, Z40);
    PlayerTextDrawHide(playerid, Z120);
    PlayerTextDrawDestroy(playerid, Z120);
    PlayerTextDrawHide(playerid, Z80);
    PlayerTextDrawDestroy(playerid, Z80);
    PlayerTextDrawHide(playerid, NadelMitte);
    PlayerTextDrawDestroy(playerid, NadelMitte);
    PlayerTextDrawHide(playerid, Nadel);
    PlayerTextDrawDestroy(playerid, Nadel);
    PlayerTextDrawHide(playerid, TankAnzeige);
    PlayerTextDrawDestroy(playerid, TankAnzeige);
    PlayerTextDrawHide(playerid, SpeedAnzeige);
    PlayerTextDrawDestroy(playerid, SpeedAnzeige);
    PlayerTextDrawHide(playerid, ZustandsAnzeige);
    PlayerTextDrawDestroy(playerid, ZustandsAnzeige);
    PlayerTextDrawHide(playerid, SpeedoHintergrund);
    PlayerTextDrawDestroy(playerid, SpeedoHintergrund);
    PlayerTextDrawHide(playerid, FahrzeugNameAnzeige);
    PlayerTextDrawDestroy(playerid,FahrzeugNameAnzeige);
    KillTimer(SpeedoTimer[playerid]);




    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
    GetPlayerVehicleID(playerid);
    PlayerTextDrawShow(playerid, Z0);
    PlayerTextDrawShow(playerid, Z160);
    PlayerTextDrawShow(playerid, Z40);
    PlayerTextDrawShow(playerid, Z120);
    PlayerTextDrawShow(playerid, Z80);
    PlayerTextDrawShow(playerid, NadelMitte);
    PlayerTextDrawShow(playerid, Nadel);
    PlayerTextDrawShow(playerid, TankAnzeige);
    PlayerTextDrawShow(playerid, SpeedAnzeige);
    PlayerTextDrawShow(playerid, ZustandsAnzeige);
    PlayerTextDrawShow(playerid, SpeedoHintergrund);
    PlayerTextDrawSetString(playerid, FahrzeugNameAnzeige, FahrzeugName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawShow(playerid, FahrzeugNameAnzeige);
    SpeedoTimer[playerid] = SetTimerEx("UpdateSpeedo", SpeedoTime, 1, "%i%i", playerid, GetPlayerVehicleID(playerid));
    }




    //speedo publics
    forward UpdateSpeedo(playerid, pVeh);
    public UpdateSpeedo(playerid, pVeh)
    {
    new Float:vX, Float:vY, Float:vZ, Float:vDamage, vpZustand[15];
    new vSpeed[15], kmh, vpTank[15];
    GetVehicleVelocity(pVeh, vX, vY, vZ);
    GetVehicleHealth(pVeh, vDamage);
    kmh = floatround(floatsqroot(vX * vX + vY * vY + vZ * vZ) * 180.00);
    format(vSpeed, 15, "km/h %i", kmh);
    format(vpZustand, 15, "Zustand %i%", floatround(vDamage/10));
    format(vpTank, 15, "Tank %i%", Gas[pVeh]/GetGasMax(GetVehicleModel(pVeh))*100);
    PlayerTextDrawSetString(playerid, TankAnzeige, vpTank);
    PlayerTextDrawSetString(playerid, ZustandsAnzeige, vpZustand);
    PlayerTextDrawSetString(playerid, SpeedAnzeige, vSpeed);
    if(kmh==0)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 547.000000, 406.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<10)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 547.000000, 404.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<20)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 547.000000, 402.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<30)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 549.000000, 400.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<40)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 550.000000, 398.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<50)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 552.000000, 397.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<60)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 554.000000, 396.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<70)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 556.000000, 395.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<80)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 559.000000, 395.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<90)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 560.000000, 395.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<100)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 561.000000, 395.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<110)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 563.000000, 396.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<120)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 565.000000, 397.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<130)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 567.000000, 399.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<140)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 568.000000, 401.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<150)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 569.000000, 403.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else if(kmh<160)
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 569.000000, 404.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    else
    {
    PlayerTextDrawDestroy(playerid, Nadel);
    Nadel = CreatePlayerTextDraw(playerid, 568.000000, 408.000000, "o");
    PlayerTextDrawLetterSize(playerid, Nadel, 0.539999, 1.800000);
    PlayerTextDrawColor(playerid, Nadel, -16776961);
    PlayerTextDrawSetOutline(playerid, Nadel, 1);
    PlayerTextDrawShow(playerid, Nadel);
    }
    return 1;
    }




    Das ist mein Tacho.






    Ich muss dazu sagen das ich erst angefangen habe zu scripten vor ca. 1 1/2 Monaten. Editiere zurzeit ein GF script erstmal. Also das Tankssystem ist dann selbverständlich ein Standart GS System.