SA-MP Forums Archive
Run Time Error and Crash... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Run Time Error and Crash... (/showthread.php?tid=591631)



Run Time Error and Crash... - Andrei1255 - 14.10.2015

Hi ! When I try to start my SA:MP server, I get this error in server_log.txt :

Код:
[20:03:33] Number of vehicle models: 1
[20:04:34] [debug] Run time error 4: "Array index out of bounds"
[20:04:34] [debug]  Accessing element at index 200 past array upper bound 199
[20:04:34] [debug] AMX backtrace:
[20:04:34] [debug] #0 00323b7c in ?? () from vitalcs.amx
[20:04:34] [debug] #1 000b3e70 in public SyncTime2 () from vitalcs.amx
[20:04:34] [debug] #2 000b3c58 in public SyncUp2 () from vitalcs.amx
[20:04:35] [debug] Server crashed while executing vitalcs.amx
[20:04:35] [debug] AMX backtrace:
[20:04:35] [debug] #0 native fwrite () from samp03svr
[20:04:35] [debug] #1 000628cc in public AllCommandLog (7165948) from vitalcs.amx
[20:04:35] [debug] #2 000b7d4c in public PayDay () from vitalcs.amx
[20:04:35] [debug] #3 000b3e10 in public SyncTime () from vitalcs.amx
[20:04:35] [debug] #4 000b3c24 in public SyncUp () from vitalcs.amx
[20:04:35] [debug] Native backtrace:
[20:04:35] [debug] #0 00220e8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[20:04:35] [debug] #1 00219bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[20:04:35] [debug] #2 0021adbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[20:04:35] [debug] #3 0021b226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[20:04:35] [debug] #4 00220adc in ?? () from plugins/crashdetect.so
[20:04:35] [debug] #5 0099440c in ?? ()
[20:04:35] [debug] #6 00994424 in ?? ()
[20:04:35] [debug] #7 00a6d871 in gsignal () from /lib/libc.so.6
[20:04:35] [debug] #8 00a6f14a in abort () from /lib/libc.so.6
[20:04:35] [debug] #9 00a66b8b in ?? () from /lib/libc.so.6
[20:04:35] [debug] #10 00a66c46 in ?? () from /lib/libc.so.6
[20:04:35] [debug] #11 0809a98c in ?? () from ./samp03svr
[20:04:35] [debug] #12 0809adef in ?? () from ./samp03svr
[20:04:35] [debug] #13 080940d4 in ?? () from ./samp03svr
[20:04:35] [debug] #14 0021c94b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[20:04:35] [debug] #15 0021f8f8 in ?? () from plugins/crashdetect.so
[20:04:35] [debug] #16 00223916 in amx_Exec () from plugins/crashdetect.so
[20:04:35] [debug] #17 0021bbe6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[20:04:35] [debug] #18 0021f659 in ?? () from plugins/crashdetect.so
[20:04:35] [debug] #19 0024b25c in ?? () from plugins/streamer.so
[20:04:35] [debug] #20 080e7345 in ?? () from ./samp03svr
[20:04:35] [debug] #21 080ad79b in ?? () from ./samp03svr
[20:04:35] [debug] #22 080a894e in ?? () from ./samp03svr
[20:04:35] [debug] #23 00a59d36 in __libc_start_main () from /lib/libc.so.6
[20:04:35] [debug] #24 0804b4e1 in ?? () from ./samp03svr
Does anybody know how can I solve these errors ? Thanks !


Re: Run Time Error and Crash... - karemmahmed22 - 14.10.2015

PHP код:
 [20:04:35] [debugServer crashed while executing vitalcs.amx 
Something on vitalcs.amx Crashed the server with error:
PHP код:
 [20:04:34] [debugRun time error 4"Array index out of bounds" 
Код:
Array index out of bounds
Check which array / string or whatever loading something bigger than its size.
But I believe one of those caused the crash:
PHP код:
[20:04:34] [debug#1 000b3e70 in public SyncTime2 () from vitalcs.amx
[20:04:34] [debug#2 000b3c58 in public SyncUp2 () from vitalcs.amx 
Check your SyncTime2 / SyncUp2 ..
Also the error says you trying to access the index '200' while the highest index in the array is '199' check your code.
PHP код:
[20:04:34] [debug]  Accessing element at index 200 past array upper bound 199 



Re: Run Time Error and Crash... - Andrei1255 - 14.10.2015

Код:
public SyncUp2()
{
	SyncTime2();
}
Код:
public SyncTime2()
{
	IncreaseVehicleHours();
}
Код:
stock IncreaseVehicleHours()
{
    for(new id = 0; id <= MAX_PLAYERS; id++)
	{
		VehicleInfo[id][minutes] += 1;
		VehicleInfo2[id][minutes] += 1;
		MotoInfo[id][minutes] += 1;
		PlaneInfo[id][minutes] += 1;
		if(VehicleInfo[id][minutes] >= 60)
		{
		    VehicleInfo[id][hours] += 1;
		    VehicleInfo[id][minutes] = 0;
		}
		if(VehicleInfo2[id][minutes] >= 60)
		{
		    VehicleInfo2[id][hours] += 1;
		    VehicleInfo2[id][minutes] = 0;
		}
		if(MotoInfo[id][minutes] >= 60)
		{
		    MotoInfo[id][hours] += 1;
		    MotoInfo[id][minutes] = 0;
		}
  		if(PlaneInfo[id][minutes] >= 60)
		{
		    PlaneInfo[id][hours] += 1;
		    PlaneInfo[id][minutes] = 0;
		}
	}
}
These are the codes, I looked but I saw nothing wrong ... Do you see anything ? Thanks !