Klammer Problem beim Tacho (Zustand)

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
  • Hallo User,
    Ich wollte mal die Zustands anzeige anders machen und zwar mit einem I was Rot, Gelb und Grün wird je nach zustand jedoch komme ich gerade nicht wirklich klar weil ich schon das für die Tank anzeige dort habe und nicht mit denn Klammern klar komme...
    So habe ich das :))
    public OnPlayerUpdate(playerid)
    {
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    new vehicleid;
    vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
    {
    new string[125];
    if(Tank[vehicleid] <= 0) format(string,sizeof string,"~g~Tank: ~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 5)
    {
    format(string,sizeof string,"~w~Tank: ~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    PlayerPlaySound(playerid, 1085, 0.0,0.0,10.0);
    }
    else if(Tank[vehicleid] <= 10)
    {
    format(string,sizeof string,"~w~Tank: ~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    PlayerPlaySound(playerid, 1085, 0.0,0.0,10.0);
    }
    else if(Tank[vehicleid] <= 15) format(string,sizeof string,"~w~Tank: ~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 20) format(string,sizeof string,"~w~Tank: ~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 25) format(string,sizeof string,"~w~Tank: ~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 30) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 35) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 40) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 45) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 50) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 55) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 60) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 65) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 70) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 75) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 80) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 85) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 90) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 95) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 100) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I",Tank[vehicleid]);
    TextDrawSetString(pSpeedo[playerid][2],string);
    }
    }
    else
    {
    TextDrawSetString(pSpeedo[playerid][2], "~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I ");
    }
    {
    new string[125];
    if(Zustand[vehicleid] <= 0) format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    else if(Zustand[vehicleid] <= 250)
    {
    format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    }
    else if(Tank[vehicleid] <= 500) format(string,sizeof string,"~w~Zustand:~y~I",Zustand[vehicleid]);
    else if(Tank[vehicleid] <= 1000) format(string,sizeof string,"~w~Zustand:~g~I",Zustand[vehicleid]);
    TextDrawSetString(pSpeedo[playerid][3],string);
    }
    }
    else
    {
    TextDrawSetString(pSpeedo[playerid][3], "~w~Zustand:~g~I");
    }
    return 1;
    }


    aber so kommen Errors:
    Bread.pwn(896) : warning 217: loose indentation
    Bread.pwn(898) : error 017: undefined symbol "Zustand"
    Bread.pwn(898) : error 017: undefined symbol "vehicleid"
    Bread.pwn(898) : error 029: invalid expression, assumed zero
    Bread.pwn(898) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

    Einmal editiert, zuletzt von EliteBread () aus folgendem Grund: CODE PWN

  • public OnPlayerUpdate(playerid)
    {
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    new vehicleid;
    vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
    {
    new string[125];
    if(Tank[vehicleid] <= 0) format(string,sizeof string,"~g~Tank: ~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 5)
    {
    format(string,sizeof string,"~w~Tank: ~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    PlayerPlaySound(playerid, 1085, 0.0,0.0,10.0);
    }
    else if(Tank[vehicleid] <= 10)
    {
    format(string,sizeof string,"~w~Tank: ~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    PlayerPlaySound(playerid, 1085, 0.0,0.0,10.0);
    }
    else if(Tank[vehicleid] <= 15) format(string,sizeof string,"~w~Tank: ~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 20) format(string,sizeof string,"~w~Tank: ~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 25) format(string,sizeof string,"~w~Tank: ~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 30) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 35) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 40) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 45) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 50) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 55) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 60) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 65) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 70) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 75) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 80) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 85) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 90) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 95) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 100) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I",Tank[vehicleid]);
    TextDrawSetString(pSpeedo[playerid][2],string);
    }
    }
    else
    {
    TextDrawSetString(pSpeedo[playerid][2], "~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I ");
    }
    {
    new string[125], Zustand[MAX_VEHICLES];
    if(Zustand[vehicleid] <= 0) format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    else if(Zustand[vehicleid] <= 250)
    {
    format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    }
    else if(Tank[vehicleid] <= 500) format(string,sizeof string,"~w~Zustand:~y~I",Zustand[vehicleid]);
    else if(Tank[vehicleid] <= 1000) format(string,sizeof string,"~w~Zustand:~g~I",Zustand[vehicleid]);
    TextDrawSetString(pSpeedo[playerid][3],string);
    }
    }
    else
    {
    TextDrawSetString(pSpeedo[playerid][3], "~w~Zustand:~g~I");
    }
    return 1;
    }


    So oder wie
    aber da ist doch 100% ein Klammer fehler bin mir sicher :)

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

  • dein Code ist ja mal sehr durcheinander 8|


    Teste mal das hier:
    public OnPlayerUpdate(playerid)
    {
    new vehicleid;
    vehicleid = GetPlayerVehicleID(playerid);
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
    {
    new string[125];
    if(Tank[vehicleid] <= 0) format(string,sizeof string,"~g~Tank: ~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 5)
    {
    format(string,sizeof string,"~w~Tank: ~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    PlayerPlaySound(playerid, 1085, 0.0,0.0,10.0);
    }
    else if(Tank[vehicleid] <= 10)
    {
    format(string,sizeof string,"~w~Tank: ~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    PlayerPlaySound(playerid, 1085, 0.0,0.0,10.0);
    }
    else if(Tank[vehicleid] <= 15) format(string,sizeof string,"~w~Tank: ~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 20) format(string,sizeof string,"~w~Tank: ~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 25) format(string,sizeof string,"~w~Tank: ~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 30) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 35) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 40) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 45) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 50) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 55) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 60) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 65) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 70) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 75) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 80) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 85) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 90) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~r~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 95) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~y~I",Tank[vehicleid]);
    else if(Tank[vehicleid] <= 100) format(string,sizeof string,"~w~Tank: ~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I~g~I",Tank[vehicleid]);
    TextDrawSetString(pSpeedo[playerid][2],string);
    }
    else
    {
    new string[125], Zustand[MAX_VEHICLES];
    GetVehicleHealth(vehicleid,Zustand[vehicleid])
    if(Zustand[vehicleid] <= 0) format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    else if(Zustand[vehicleid] <= 250)
    {
    format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    }
    else if(Tank[vehicleid] <= 500) { format(string,sizeof string,"~w~Zustand:~y~I",Zustand[vehicleid]); }
    else if(Tank[vehicleid] <= 1000) { format(string,sizeof string,"~w~Zustand:~g~I",Zustand[vehicleid]); }
    TextDrawSetString(pSpeedo[playerid][3],string);
    }
    }
    TextDrawSetString(pSpeedo[playerid][3], "~w~Zustand:~g~I");
    return 1;
    }
    Ausserdem empfehle ich dir anstatt OnPlayerUpdate mit einem Timer zu arbeiten.

  • Der Fehler kommt
    Bread.pwn(894) : warning 213: tag mismatch
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    1 Warning.



    Suche gerade schon :) was falsch ist
    Finde nicht denn Fehler :/
    ich weiß nur das der Fehler hier drinn ist .
    GetVehicleHealth(vehicleid,Zustand[vehicleid])

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

    2 Mal editiert, zuletzt von EliteBread () aus folgendem Grund: Text

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Also Errors kommen schon mal nicht :)
    mal sehen ob es geht
    @Nightstr3am:
    Ich wollte Ein Strich der die Farbe ändert am Anfang hatte ich auch erst zahlen da.
    Gefiel mir aber nicht so gut.


    Leider geht es immer noch nicht der Strich ist und bleibt grün :/


    ew string[125], Float:Zustand[MAX_VEHICLES];
    GetVehicleHealth(vehicleid,Zustand[vehicleid]);
    if(Zustand[vehicleid] <= 0) format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    else if(Zustand[vehicleid] <= 250)
    {
    format(string,sizeof string,"~w~Zustand:~r~I",Zustand[vehicleid]);
    }
    else if(Tank[vehicleid] <= 600) { format(string,sizeof string,"~w~Zustand:~y~I",Zustand[vehicleid]); }
    else if(Tank[vehicleid] <= 1000) { format(string,sizeof string,"~w~Zustand:~g~I",Zustand[vehicleid]); }
    TextDrawSetString(pSpeedo[playerid][3],string);
    }
    }
    TextDrawSetString(pSpeedo[playerid][3], "~w~Zustand:~g~I");


    stock UpdateSpeedo(playerid)
    {
    if(!IsPlayerInAnyVehicle(playerid))
    {
    Speedo(playerid,0);
    } else if(pSpeedoOn[playerid] == 2) {
    new veh = GetPlayerVehicleID(playerid);
    new model= GetVehicleModel(veh);
    new str[60];
    TextDrawSetString(pSpeedo[playerid][0],CarName[model-400]);
    new speed = GetPlayerSpeed(playerid, true);
    if(model == 509 || model == 510|| model == 481)
    {
    speed = floatround(speed *0.5);
    } else {
    speed = floatround(speed * 0.95);
    }
    format(str,sizeof(str),"~w~Km/H: ~w~%d",speed);
    TextDrawSetString(pSpeedo[playerid][1],str);
    format(str,sizeof(str),"~w~Zustand:");
    TextDrawSetString(pSpeedo[playerid][3],str);
    }
    }


    stock GetVehicleZustandProzent(Veh,Minus250 = false,prozent = false)
    {
    new Float:Zust;
    GetVehicleHealth(Veh,Zust);
    if(prozent)
    {
    if(Minus250)
    {
    Zust = Zust - 250;
    Zust = Zust / 10;
    Zust = Zust / 75;
    Zust = Zust *100;
    } else {
    Zust=Zust/10;
    }
    }
    return floatround(Zust, floatround_round);
    }
    Ich habe mal rausgesucht was alles mit Zustand zutun hat ist da irgendwo ein fehler drinne ?
    Weil ja nur Das I in Grün angezeigt wird


    Muss ich das unterstock UpdateSpeedo(playerid)
    einbauen


    Bitte um schnelle Hilfe bleibe gerade daran Kleben und komme einfach nicht weiter :/


    MfG Flo

    ↓Das ist der Youtube Channel von mir und meinen Kollegen↓



    Sa-Mp Server [Im Aufbau/Beta]
    128.65.216.200:7777

    5 Mal editiert, zuletzt von EliteBread () aus folgendem Grund: 6xText