Accessing element at index 16 past array upper bound 15 [Fehler]

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,


    Ich wollte zu meinen GangFightZones eine neue hinzufügen, doch habe damit erhebliche Probleme bekommen,


    Vorher sah es so aus:




    enum GFInfo
    {
    GFGangZoneID,
    GFOwnerID,
    GFGegnerID,
    GFOwnerPoints,
    GFGegnerPoints,
    Float:MinX,
    Float:MinY,
    Float:MaxX,
    Float:MaxY,
    GFRunningTime,
    GFPauseTime,
    Float:PickupX,
    Float:PickupY,
    Float:PickupZ,
    GFCTFPlayer,
    GFCTFTimer,
    GFOwnerCTF,
    GFGegnerCTF,
    };
    new GangfightSystemInfo[16][GFInfo] =
    {
    {-1,18,-1,0,0,779.5656,-1639.3149, 1024.6346,-1411.4283,-1,0,874.6680,-1504.9249,12.7164},//Bss
    {-1,17,-1,0,0,2105.925, -2372.717, 2269.447, -2147.695,-1,0,2150.9788,-2256.2292,13.2986},//LS Hafen
    {-1,17,-1,0,0,986.386, 1809.776, 1185.533, 2049.596,-1,0,1066.4142,1883.8596,10.8203},//LV Container gebiet
    {-1,6,-1,0,0,-1869.358, 870.2093, -1656.91, 1130.577,-1,0,-1717.2057,1017.6675,17.5859},//SF Bank
    {-1,20,-1,0,0,-934.23, 1342.956, -537.1823, 1658.258,-1,0,-797.2783,1522.8790,26.9849},//LV Wüste
    {-1,24,-1,0,0,-624.3357,-199.8011, -423.9013,-36.6984,-1,0,-533.4424,-102.6740,63.2969},//Nahe Bauernhof
    {-1,24,-1,0,0,1828.318, -1946.361, 2075.502, -1756.869,-1,0,1956.6233,-1850.9685,4.1632},//Tanksten gebiet
    {-1,25,-1,0,0,1352.5580, 658.3295, 1557.2694, 797.5881,-1,0,1457.9932,738.5165,11.0234},//LV Nahe GRP YakuzaBase
    {-1,18,-1,0,0,-1424.701, 2230.474, -1132.754, 2639.2,-1,0,-1308.1746,2543.1692,87.7422},//Gangfight an den Tippies
    {-1,18,-1,0,0,-1496.5255,1461.5786, -1342.6473,1511.1339,-1,0,-1423.2755,1489.7532,1.8672},//Schiff Gebiet
    {-1,5,-1,0,0,1688.3701,2713.3540,1922.8389,2886.8803 ,-1,0,1797.1097,2784.0983,10.5630},//LV mit Pool
    {-1,22,-1,0,0,2228.4958,2713.3449,2462.1494,2827.0939 ,-1,0,2335.4101,2786.2687,10.5481},//LV an der Tanke
    {-1,6,-1,0,0,2527.4624,2233.3325,2677.5786,2484.3283 ,-1,0,2576.3649,2341.7500,17.8144},//LV am Hotel
    {-1,19,-1,0,0,2188.4631,-128.3329,2582.0745,204.6441,-1,0,2385.0674,36.4485,26.4844},//Oben bisschen über LS
    {-1,23,-1,0,0,-1522.6212,-1659.5980,-1318.6132,-1364.9719 ,-1,0,-1434.4113,-1540.5759,101.7578},//SF Am Mound Chilliad
    {-1,19,-1,0,0,-1858.2706,1370.4858,-1692.5876,1584.2093 ,-1,0,-1741.3501,1544.2088,7.1875}//SF Am Schiff
    };






    Nach meiner Bearbeitung so:




    enum GFInfo
    {
    GFGangZoneID,
    GFOwnerID,
    GFGegnerID,
    GFOwnerPoints,
    GFGegnerPoints,
    Float:MinX,
    Float:MinY,
    Float:MaxX,
    Float:MaxY,
    GFRunningTime,
    GFPauseTime,
    Float:PickupX,
    Float:PickupY,
    Float:PickupZ,
    GFCTFPlayer,
    GFCTFTimer,
    GFOwnerCTF,
    GFGegnerCTF,
    };
    new GangfightSystemInfo[17][GFInfo] =
    {
    {-1,18,-1,0,0,779.5656,-1639.3149, 1024.6346,-1411.4283,-1,0,874.6680,-1504.9249,12.7164},//Bss
    {-1,17,-1,0,0,2105.925, -2372.717, 2269.447, -2147.695,-1,0,2150.9788,-2256.2292,13.2986},//LS Hafen
    {-1,17,-1,0,0,986.386, 1809.776, 1185.533, 2049.596,-1,0,1066.4142,1883.8596,10.8203},//LV Container gebiet
    {-1,6,-1,0,0,-1869.358, 870.2093, -1656.91, 1130.577,-1,0,-1717.2057,1017.6675,17.5859},//SF Bank
    {-1,20,-1,0,0,-934.23, 1342.956, -537.1823, 1658.258,-1,0,-797.2783,1522.8790,26.9849},//LV Wüste
    {-1,24,-1,0,0,-624.3357,-199.8011, -423.9013,-36.6984,-1,0,-533.4424,-102.6740,63.2969},//Nahe Bauernhof
    {-1,24,-1,0,0,1828.318, -1946.361, 2075.502, -1756.869,-1,0,1956.6233,-1850.9685,4.1632},//Tanksten gebiet
    {-1,25,-1,0,0,1352.5580, 658.3295, 1557.2694, 797.5881,-1,0,1457.9932,738.5165,11.0234},//LV Nahe GRP YakuzaBase
    {-1,18,-1,0,0,-1424.701, 2230.474, -1132.754, 2639.2,-1,0,-1308.1746,2543.1692,87.7422},//Gangfight an den Tippies
    {-1,18,-1,0,0,-1496.5255,1461.5786, -1342.6473,1511.1339,-1,0,-1423.2755,1489.7532,1.8672},//Schiff Gebiet
    {-1,5,-1,0,0,1688.3701,2713.3540,1922.8389,2886.8803 ,-1,0,1797.1097,2784.0983,10.5630},//LV mit Pool
    {-1,22,-1,0,0,2228.4958,2713.3449,2462.1494,2827.0939 ,-1,0,2335.4101,2786.2687,10.5481},//LV an der Tanke
    {-1,6,-1,0,0,2527.4624,2233.3325,2677.5786,2484.3283 ,-1,0,2576.3649,2341.7500,17.8144},//LV am Hotel
    {-1,19,-1,0,0,2188.4631,-128.3329,2582.0745,204.6441,-1,0,2385.0674,36.4485,26.4844},//Oben bisschen über LS
    {-1,23,-1,0,0,-1522.6212,-1659.5980,-1318.6132,-1364.9719 ,-1,0,-1434.4113,-1540.5759,101.7578},//SF Am Mound Chilliad
    {-1,19,-1,0,0,-1858.2706,1370.4858,-1692.5876,1584.2093 ,-1,0,-1741.3501,1544.2088,7.1875},//SF Am Schiff
    {-1,19,-1,0,0,1071.09375,-1570.3125,1185.9375,-1417.96875 ,-1,0,1169.9668,-1489.3143,22.7558}
    };




    Nun habe ich keine Errors beim compilen bekommen, aber beim Serverstart kommt im Debug folgendes:


    [11:47:33] Beginne Gangzonen zu erstellen
    [11:47:33] [debug] Run time error 4: "Array index out of bounds"
    [11:47:33] [debug] Accessing element at index 16 past array upper bound 15


    Meine Datenbank-Spalte für die Ganggebiete sieht so aus:



    Ich hoffe jemand kann mir helfen :S

  • [12:42:07] Beginne Gangzonen zu erstellen
    [12:42:07] [debug] Run time error 4: "Array index out of bounds"
    [12:42:07] [debug] Accessing element at index 16 past array upper bound 15
    [12:42:07] [debug] AMX backtrace:
    [12:42:07] [debug] #0 000a282c in public FC_OnGameModeInit () from revolution.amx
    [12:42:07] [debug] #1 native CallLocalFunction () from samp4444_6036
    [12:42:07] [debug] #2 000031c4 in public OnGameModeInit () from revolution.amx


    @Jeffry
    Sorry hab die Hälfte vergessen :S


    Das hier ist der Bereich in OnGameModeInit der nach dem Gangzonen zu erstellen Satz kommt:



    printf("SERVER: Der Server wurde erfolgreich gestartet");
    new string3[123];
    for(new i=0; i<MAX_PLAYERS;i++){
    if(IsPlayerConnected(i)){
    format(string3, sizeof(string3), "UPDATE `users` SET `Status`='0'");
    self_mysql_queryEx(string3);
    format(string3, sizeof(string3), "UPDATE `users` SET `Legende`='0'");
    self_mysql_queryEx(string3);
    }
    }
    mysql_debug(1);//um alles MySQL zu debuggen 0 = Aus -> 1 = An
    new string[MAX_PLAYER_NAME],
    string1[MAX_PLAYER_NAME],
    string2[256];


    #if defined MySQL
    MySQLConnection = mysql_connect(MySQL_Host, MySQL_User, MySQL_DB, MySQL_Passwort);
    printf("SERVER: Versucht die Verbindung zur Datenbank aufzubauen");
    #endif


    LoadProperty();
    printf("OnGamemodeInt: LoadProperty");
    LoadBiz();
    printf("OnGamemodeInt: LoadBiz");
    LoadSBiz();
    printf("OnGamemodeInt: LoadSBiz");
    LoadTankenBiz();
    printf("OnGamemodeInt: LoadTankenBiz");
    LoadGangAutos();
    printf("OnGamemodeInt: LoadGangAutos");
    LoadStuff();
    printf("OnGamemodeInt: LoadStuff");
    LoadKassenInfo();
    printf("OnGamemodeInt: LoadKassenInfo");
    LoadGangfightZones();
    printf("OnGamemodeInt: LoadGangfightZones");
    LoadGangWarInfos();
    printf("OnGamemodeInt: LoadGangWarInfos");
    LoadGangmotd();
    printf("OnGamemodeInt: LoadGangMotds");
    LoadGangBNDInfos();
    printf("OnGamemodeInt: LoadGangBNDInfos");


    //NO-DM Zonen
    for(new i = 0; i < sizeof(NODMZonenInfo); i++)
    {
    NODMZonenInfo[i][NODMZoneID] = GangZoneCreate(NODMZonenInfo[i][NODMMinX],NODMZonenInfo[i][NODMMinY],NODMZonenInfo[i][NODMMaxX],NODMZonenInfo[i][NODMMaxY]);
    }
    for(new i = 0; i < sizeof(VersteckSystemInfo); i++)
    {
    Create3DTextLabel("Du befindest dich in einem Versteck.\nDetective können dich hier nicht aufsuchen!\nWenn du in den Wantedstern fährst kriegst du einen 60 Sekunden schutz!",COLOR_WHITE,VersteckSystemInfo[i][AchseX],VersteckSystemInfo[i][AchseY],VersteckSystemInfo[i][AchseZ],5.0,0,0);
    CreatePickup(1247, 23,VersteckSystemInfo[i][AchseX],VersteckSystemInfo[i][AchseY],VersteckSystemInfo[i][AchseZ]);
    }
    for(new i = 0; i < sizeof(SprayInformation); i++)
    {
    CreatePickup(365, 23,SprayInformation[i][AchseX],SprayInformation[i][AchseY],SprayInformation[i][AchseZ]);
    }
    printf("Beginne Gangzonen zu erstellen");
    //NO-DM Zonen Ende
    /*Gangzonen*/
    BrigadaBase = GangZoneCreate(-54.2290,-2491.8645,23.2576,-2540.7542);
    VagosBase = GangZoneCreate(2394.94, -1101.544, 2585.082, -971.2684);
    RedSoldiersBase = GangZoneCreate(648.578125, -1314.205688, 784.578125, -1138.205688);
    BallasBase = GangZoneCreate(1839.726, -1283.14, 2094.516, -1093.648);
    LCNBase = GangZoneCreate(240.8581,-1407.9194, 306.8853,-1304.2410);
    BikerBoysBase = GangZoneCreate(650.6146,-479.6148, 711.0463,-438.2694);
    SFRifasBase = GangZoneCreate(-2204.2942,-283.5495,-2097.5405,-81.7443);
    TriadenBase = GangZoneCreate(-2842.754, -407.9592, -2580.092, -183.0962);
    YakuzaBase = GangZoneCreate(1178.0531,962.7449, 973.6961,1163.6390);
    AtztecasBase = GangZoneCreate(2423.7944,-2036.5070, 2541.0527,-1981.6846);
    GroveStreetBase = GangZoneCreate(2204.798, -1847.667, 2611.702, -1626.594);
    CaliKartell = GangZoneCreate(2048.504, 1542.879, 2403.845, 1774.963);
    IrishCrimeBase = GangZoneCreate(2777.8538,833.9950, 2894.7046,1022.9520);
    /*Gangfight*/
    for(new i = 0; i < sizeof(GangfightSystemInfo); i++)
    {
    GangfightSystemInfo[i][GFGangZoneID] = GangZoneCreate(GangfightSystemInfo[i][MinX],GangfightSystemInfo[i][MinY],GangfightSystemInfo[i][MaxX],GangfightSystemInfo[i][MaxY]);
    CreatePickup(1314, 23,GangfightSystemInfo[i][PickupX],GangfightSystemInfo[i][PickupY],GangfightSystemInfo[i][PickupZ]);
    CTFDraw[i] = TextDrawCreate(551.000000, 56.000000, "~w~CTF Time: ~g~5:00");
    TextDrawBackgroundColor(CTFDraw[i], 255);
    TextDrawFont(CTFDraw[i], 1);
    TextDrawLetterSize(CTFDraw[i], 0.210000, 1.000000);
    TextDrawColor(CTFDraw[i], -1);
    TextDrawSetOutline(CTFDraw[i], 1);
    TextDrawSetProportional(CTFDraw[i], 1);
    }
    for(new i = 0; i < MAX_PLAYERS; i++){
    Tacho[i] = TextDrawCreate(2.000000, 300.000000, "~n~");//Tacho GRP Like
    TextDrawBackgroundColor(Tacho[i], 255);
    TextDrawFont(Tacho[i], 1);
    TextDrawLetterSize(Tacho[i], 0.300000, 1.100000);
    TextDrawColor(Tacho[i], -1);
    TextDrawSetOutline(Tacho[i], 0);
    TextDrawSetProportional(Tacho[i], 1);
    TextDrawSetShadow(Tacho[i], 1);
    TextDrawUseBox(Tacho[i], 1);
    TextDrawBoxColor(Tacho[i], 0x0000004B);
    TextDrawTextSize(Tacho[i], 150.000000, 0.000000);//Tacho GRP Like Ende



    Einmal editiert, zuletzt von ShAdoWxX ()

  • Am Log hat sich zwar nichts geändert, da hast du eventuell was vergessen, aber ich nehme an, dass das Problem am CTFDraw Array liegt.
    Das hast du wahrscheinlich noch mit [16] deklariert. Ändere das zu [17].


    new Text:CTFDraw[17];