Jump to content
  • 0

Accessing element at index 501 past array upper bound 499


NERS

Question

Salut, am incercat sa fac un sistem de vehicule personale si am intampinat aceasta eroare in consola cand dau /q, are cineva idee de ce?

[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 501 past array upper bound 499
[debug] AMX backtrace:
[debug] #0 0007ae44 in public ppb_OnPlayerDisconnect (playerid=0, reason=1) at gm.pwn:4954
[debug] #1 00024de8 in ?? (... <2 arguments>) at C:\GTA San Andreas\Gamemode\pawno\include\playerprogress.inc:135
[debug] #2 0001b410 in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at C:\GTA San Andreas\Gamemode\pawno\include\YSI\y_hooks/impl.inc:682
[debug] #3 00003968 in public Itter_OnPlayerDisconnect (playerid=0, reason=1) at C:\GTA San Andreas\Gamemode\pawno\include\sscanf2.inc:260
[debug] #4 000028f0 in public OnPlayerDisconnect (playerid=0, reason=1) at C:\GTA San Andreas\Gamemode\pawno\include\YSI\y_iterate.inc:909
[part] NERS has left the server (0:1)

 

Iteratorii arata asa:

#undef MAX_PLAYERS

#define MAX_PLAYERS 50

#define MAX_PLAYER_PERSONAL_VEHICLES  10
#define MAX_PLAYERS_PERSONAL_VEHICLES MAX_PLAYERS * MAX_PLAYER_PERSONAL_VEHICLES 

Iterator: TotalPersonalVehicles<MAX_PLAYERS_PERSONAL_VEHICLES>,
IteratorArray: PersonalVehicles[MAX_PLAYERS]<MAX_PLAYERS_PERSONAL_VEHICLES>,

 

Loop-ul cu probleme:

    foreach(i : PersonalVehicles[playerid]) {
           for(new c; c < 17; c++) CarInfo[i][cComponents][c] = 0; //asta este linia unde primesc eroare

           if(CarInfo[i][cSpawned] != INVALID_VEHICLE_ID) DestroyVehicleEx(CarInfo[i][cSpawned]);
          CarInfo[i][cUserid]       = INVALID_PLAYER_ID;
        CarInfo[i][cSpawned]      = INVALID_VEHICLE_ID;
        CarInfo[i][cDespawnTime]  = 0;

        CarInfo[i][cOwner]         = (EOS);
        CarInfo[i][cPlate]          = (EOS);

        CarInfo[i][cID]                 = 0;
        CarInfo[i][cModel]            = 0;
        CarInfo[i][cFuel]            = 0;
        CarInfo[i][cAge]           = 0;
        CarInfo[i][cColorOne]     = 0;
        CarInfo[i][cColorTwo]     = 0;
        CarInfo[i][cInsurance]    = 0;
        CarInfo[i][cPaintjob]     = 0;
        CarInfo[i][cVirtualWorld] = 0;
        CarInfo[i][cInterior]     = 0;

        CarInfo[i][cLocationx]    = 0;
        CarInfo[i][cLocationy]    = 0;
        CarInfo[i][cLocationz]    = 0;
        CarInfo[i][cAngle]           = 0;
        CarInfo[i][cKM]                = 0;

        CarInfo[i][cLock]            = false;      

        Iter_SafeRemove(TotalPersonalVehicles, i, i);
        Iter_SafeRemove(PersonalVehicles[playerid], i, i);
    }

Edited by NERS
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

    for(new c; c < 17; c++) CarInfo[i][cComponents][c] = 0; 

 

Accessing element at index 501 past array upper bound 499 

scrie ca sare peste 499. care poate fii si in baza de date. 

 

Nu ma mai coup pe partea de script pawn de un timp lung dar din cate imi amintesc 

 

 

Cand eram mic, eram mare zdreanta Eu fut*am femei, vara miu umbla prin casa

LINIE-3.gif.f4c03161035b1ce4c431755a78bed2ae.gif.aacf6e45f3894429f134b2e37f997f6f.gif

Discord: ㍿ Luca лол㍿ツ#5482

Sunt de moda veche inca mai cred in Respect!

LINIE-3.gif.f4c03161035b1ce4c431755a78bed2ae.gif.bcf86dadd9b43351554dd738f470725f.gif

 

Link to comment
Share on other sites

  • 0
Acum 5 minute, Luca Gipsy a spus:

    for(new c; c < 17; c++) CarInfo[i][cComponents][c] = 0; 

 

Accessing element at index 501 past array upper bound 499 

scrie ca sare peste 499. care poate fii si in baza de date. 

 

Nu ma mai coup pe partea de script pawn de un timp lung dar din cate imi amintesc 

Nu este de la ea, am comentat-o si primesc erori la urmatoarea linie si tot asa

Link to comment
Share on other sites

  • 0
Acum 1 minut, zNx[] a spus:

Ce ar vrea sa fie acel "c" ? for(new c; c < 17; c++) CarInfo[i][cComponents][c] = 0; 

cComponents este un array de marimea 17 (unde stochez nitro, spoiler, etc) si setez fiecare variabila din acel array la 0

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.