Habe ein Kleines Problem Kann Da einer Helfen

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
  • Hey Leute habe ein Kleines Problem weiß nicht woran das liegen kann kann mir da einer Helfen MfG Lui




    [debug] Run time error 4: "Array index out of bounds"
    [debug] Attempted to read/write array element at negative index -400
    [debug] AMX backtrace:
    [debug] #0 00271e7c in public Tachometer (12) from GeTmyselfmade.amx




    public Tachometer(playerid)
    {
    new Float:Speedo_Hp,Float:TankInProzent,string[128];
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleHealth(vehicleid,Speedo_Hp);
    if(vFahrzeug[vehicleid][Handbremse] == 0)
    {
    GetVehiclePos(vehicleid,vFahrzeug[vehicleid][OldVehPos][0],vFahrzeug[vehicleid][OldVehPos][1],vFahrzeug[vehicleid][OldVehPos][2]);
    GetVehicleZAngle(vehicleid,vFahrzeug[vehicleid][OldVehPos][3]);
    }
    vFahrzeug[vehicleid][Kilometer] += GetDistanceToLastPoint(vehicleid);
    TankInProzent = VehicleInfo[GetVehicleModel(vehicleid)-400][vtankvolumen]/100;
    if(Motor[vehicleid] == true)
    {
    vFahrzeug[vehicleid][Tankkm] += GetDistanceToLastPoint(vehicleid);
    if((vFahrzeug[vehicleid][Tankkm]/1000) >= 1)
    {
    vFahrzeug[vehicleid][Tank] -= VehicleInfo[GetVehicleModel(vehicleid)-400][vtankverbrauch];
    vFahrzeug[vehicleid][Tankkm] = 0;
    }
    }



    /*if(Spieler[playerid][pShowVehInfo] == 0)
    {
    //PlayerTextDrawShow(playerid,INFOdraw[playerid][3]);
    PlayerTextDrawShow(playerid,INFOdraw[playerid][1]);
    PlayerTextDrawShow(playerid,INFOdraw[playerid][3]),PlayerTextDrawSetString(playerid,INFOdraw[playerid][3],"~b~Taste Z:~n~~w~Infobox ein-/ausschalten~n~~b~Taste Num2:~n~~w~Motor ein-/ausschalten~n~~b~Taste Num8:~n~~w~Licht ein-/ausschalten~n~~b~Taste Num4:~n~~w~Radiomenu anzeigen~n~~b~Taste Num6:~n~~w~Handbremse ein-/ausschalten~n~~b~Fahrzeugkontrolle:~n~~w~/cv");
    }*/



    else
    PlayerTextDrawHide(playerid,INFOdraw[playerid][1]);
    PlayerTextDrawHide(playerid,INFOdraw[playerid][3]);
    PlayerTextDrawShow(playerid,Tacho[playerid][0]);
    PlayerTextDrawShow(playerid,Tacho[playerid][1]);
    PlayerTextDrawShow(playerid,Tacho[playerid][2]);
    PlayerTextDrawShow(playerid,Tacho[playerid][3]);
    PlayerTextDrawShow(playerid,Tacho[playerid][15]);
    PlayerTextDrawShow(playerid,Tacho[playerid][16]);
    PlayerTextDrawShow(playerid,Tacho[playerid][17]);
    PlayerTextDrawShow(playerid,Tacho[playerid][18]);

    //==================================================================
    if(Speedo_Hp < 450){ format(string,sizeof(string),"~r~%s",VehicleDefinations[GetVehicleModel(vehicleid)-400]); }
    else if(Speedo_Hp < 750){ format(string,sizeof(string),"~y~%s",VehicleDefinations[GetVehicleModel(vehicleid)-400]); }
    else if(Speedo_Hp <= 1000){ format(string,sizeof(string),"~g~%s",VehicleDefinations[GetVehicleModel(vehicleid)-400]); }
    PlayerTextDrawSetString(playerid,Tacho[playerid][1],string);//fahrzeugnamen anzeige
    format(string,sizeof(string),"%i Km/h",GetVehicleSpeed(vehicleid));
    PlayerTextDrawSetString(playerid,Tacho[playerid][2],string);//Km/h anzeige
    //format(string,sizeof(string),"Km: ~w~%i",vFahrzeug[vehicleid][Kilometer]/1000);
    format(string,sizeof(string),"Km: ~w~%i.%i",vFahrzeug[vehicleid][Kilometer]/1000,vFahrzeug[vehicleid][Kilometer]%1000);
    PlayerTextDrawSetString(playerid,Tacho[playerid][18],string);//digitale kilometeranzeige/stand
    PlayerTextDrawSetString(playerid,Tacho[playerid][16],"--");//digitale tankanzeige
    if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510 && !IsVehAZug(vehicleid))
    {
    format(string,sizeof(string),"%.2f L",vFahrzeug[vehicleid][Tank]);
    PlayerTextDrawSetString(playerid,Tacho[playerid][16],string);//digitale tankanzeige
    if(vFahrzeug[vehicleid][Tank]/TankInProzent == 100)
    {
    PlayerTextDrawShow(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 90)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawShow(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 80)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawShow(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 65)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawShow(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 50)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawShow(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 40)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawShow(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 30)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawShow(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 20)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawShow(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 10)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawShow(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 5)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawShow(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawHide(playerid,Tacho[playerid][14]);//0
    }
    else if(vFahrzeug[vehicleid][Tank]/TankInProzent >= 0)
    {
    PlayerTextDrawHide(playerid,Tacho[playerid][4]);//100
    PlayerTextDrawHide(playerid,Tacho[playerid][5]);//90
    PlayerTextDrawHide(playerid,Tacho[playerid][6]);//80
    PlayerTextDrawHide(playerid,Tacho[playerid][7]);//65
    PlayerTextDrawHide(playerid,Tacho[playerid][8]);//50
    PlayerTextDrawHide(playerid,Tacho[playerid][9]);//40
    PlayerTextDrawHide(playerid,Tacho[playerid][10]);//30
    PlayerTextDrawHide(playerid,Tacho[playerid][11]);//20
    PlayerTextDrawHide(playerid,Tacho[playerid][12]);//10
    PlayerTextDrawHide(playerid,Tacho[playerid][13]);//5
    PlayerTextDrawShow(playerid,Tacho[playerid][14]);//0
    }
    }
    GetVehiclePos(vehicleid,vFahrzeug[vehicleid][Xs],vFahrzeug[vehicleid][Ys],vFahrzeug[vehicleid][Zs]);
    //==================================================================
    if(Spieler[playerid][InFahrSchulPruefung] == 1)
    {
    if(Spieler[playerid][pSchulungsCPautolic] != 0 || Spieler[playerid][pSchulungsCPmotorbikelic] != 0 || Spieler[playerid][pSchulungsCProllerlic] != 0)
    {
    if(GetVehicleSpeed(vehicleid) > 80)
    {
    if(gettime() > Spieler[playerid][pSchulungsAntiSpam])
    {
    Spieler[playerid][pSchulungsWARNS]++;
    Spieler[playerid][pSchulungsAntiSpam] = gettime() + 10;
    format(string,sizeof(string),"Du hast die Maximalgeschwindigkeit von 80 Km/h überschritten! Verwarnungen %i/3",Spieler[playerid][pSchulungsWARNS]);
    SCM(playerid,ROT,string);
    CreateBox(playerid,"Info","~w~Nicht so ~r~schnell!");
    }
    }
    if(Spieler[playerid][pSchulungsWARNS] >= 3)
    {
    SCM(playerid,ROT,"Deine Prüfung wurde abgebrochen! Du hast nicht bestanden.");
    CreateBox(playerid,"Info","~w~Du bist ~r~Durchgefallen!");
    Spieler[playerid][pSchulungsCPautolic] = 0;
    Spieler[playerid][pSchulungsCPmotorbikelic] = 0;
    Spieler[playerid][pSchulungsCProllerlic] = 0;
    Spieler[playerid][pSchulungsWARNS] = 0;
    RemovePlayerFromVehicle(playerid);
    DisablePlayerCheckpoint(playerid);
    SetPlayerPosEx(playerid,-2033.4276,-117.4092,1035.1719);
    SetPlayerInterior(playerid,3);
    SetPlayerVirtualWorld(playerid,0);
    Spieler[playerid][InFahrSchulPruefung] = 0;
    DeleteVehicle(Spieler[playerid][pSchulungsVEH]);
    Spieler[playerid][pSchulungsVEH] = -1;
    }
    }
    }
    return 1;
    }