Debug...OnGameModeInit... HELP
#1

Код:
[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
Reply
#2

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.
Reply
#3

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

Код:
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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)