SA-MP Forums Archive
Debug...OnGameModeInit... HELP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Debug...OnGameModeInit... HELP (/showthread.php?tid=614085)



Debug...OnGameModeInit... HELP - kexy96 - 04.08.2016

Код:
[13:57:17] [debug] Run time error 4: "Array index out of bounds"
[13:57:17] [debug]  Accessing element at index 50 past array upper bound 49
[13:57:17] [debug] AMX backtrace:
[13:57:17] [debug] #0 00013214 in public SSCANF_OnGameModeInit () from lsrp.amx
[13:57:17] [debug] #1 00005f98 in public Itter_OnGameModeInit () from lsrp.amx
[13:57:17] [debug] #2 native CallLocalFunction () from samp03svr
[13:57:17] [debug] #3 00003910 in public ScriptInit_OnGameModeInit () from lsrp.amx
[13:57:17] [debug] #4 000028f0 in public OnGameModeInit () from lsrp.amx
WHATS THE PROBLEM
But the game mode is running


Re: Debug...OnGameModeInit... HELP - WingedFrostWolf - 04.08.2016

I've found a similar problem resolved here: https://sampforum.blast.hk/showthread.php?tid=321919
Take a look at it, maybe it's the same fix.


Re: Debug...OnGameModeInit... HELP - Stinged - 04.08.2016

You have an array with a max size of 50.
The highest usable index would be 49 because the last one is for NULL.


Re: Debug...OnGameModeInit... HELP - kexy96 - 04.08.2016

Код:
for(new n = 0; n < MAX_OBJ; n++) dGunData[n][ObjID] = -1;
	#if defined SAVING
	new File:file = fopen("DroppedGuns.ini", io_read);
    if(file)
    {
        new buffer[256], FileCoords[5][20];
        for(new g = 0; g < MAX_OBJ; g++)
        {
            fread(file, buffer);
            split(buffer, FileCoords, ',');
            dGunData[g][ObjPos][0] = floatstr(FileCoords[0]);
			dGunData[g][ObjPos][1] = floatstr(FileCoords[1]);
			dGunData[g][ObjPos][2] = floatstr(FileCoords[2]);
			dGunData[g][ObjData][0] = strval(FileCoords[3]);
			dGunData[g][ObjData][1] = strval(FileCoords[4]);
			if(dGunData[g][ObjData][0] > 0 && dGunData[g][ObjData][1] != 0 && dGunData[g][ObjPos][0] != 0)
			{
				dGunData[g][ObjID] = CreateObject(GunObjects[dGunData[g][ObjData][0]], dGunData[g][ObjPos][0], dGunData[g][ObjPos][1], dGunData[g][ObjPos][2]-1, 93.7, 120.0, 120.0);
				printf("* %s Betцlve: %f,%f,%f", GunNames[dGunData[g][ObjData][0]], dGunData[g][ObjPos][0], dGunData[g][ObjPos][1], dGunData[g][ObjPos][2]-1);
			}
        }
    }
Hmmm, I think this lines... problem