SA-MP Forums Archive
Server Crashed (+ rep) - 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: Server Crashed (+ rep) (/showthread.php?tid=636697)



Server Crashed (+ rep) - Nin9r - 02.07.2017

Код HTML:
[20:03:20] [debug] Server crashed while executing gm.amx
[20:03:20] [debug] AMX backtrace:
[20:03:20] [debug] #0 00530e4c in public PlaceADDS () at D:\server\gm.pwn:91071
[20:03:20] [debug] Native backtrace:
[20:03:20] [debug] #0 f745ee8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[20:03:20] [debug] #1 f7457bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[20:03:20] [debug] #2 f7458dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[20:03:20] [debug] #3 f7459226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[20:03:20] [debug] #4 f745eadc in ?? () from plugins/crashdetect.so
[20:03:20] [debug] #5 f774e410 in ?? ()
Код HTML:
forward PlaceADDS();
public PlaceADDS()
{
    if(strlen(AdvMSG[0]) > 1) SendClientMessageToAll(COLOR_GREEN, AdvMSG[0]);
    for(new i = 0; i < sizeof(AdvMSG); i++)
    {  ->>>>>>>>>>>>>>>> LINE 91071
		if(i < sizeof(AdvMSG)-1)
		{
		    format(AdvMSG[i],256,"%s",AdvMSG[i+1]);
		    format(AdvMSG[i+1],256," ");

		    format(AdvPlayer[i],24,"%s",AdvPlayer[i+1]);
		    format(AdvPlayer[i+1],24," ");
		}
    }
	return 1;
}



Re: Server Crashed (+ rep) - Sgt.TheDarkness - 03.07.2017

Код:
if(i < sizeof(AdvMSG)-1)
Try this:

Код:
if(i < sizeof(AdvMSG)!= -1)



Re: Server Crashed (+ rep) - iKarim - 03.07.2017

Quote:
Originally Posted by Sgt.TheDarkness
Посмотреть сообщение
[code]
Код:
if(i < sizeof(AdvMSG)!= -1)
I am sorry but what does this code do? It's kinda illogical, since the result of first expression will ALWAYS be 0 or 1, it'll never be -1. The actual code from OP is logical, it's basically if i < ( sizeof the message - 1 )


Re: Server Crashed (+ rep) - Nin9r - 04.07.2017

So what's the problem?


Re: Server Crashed (+ rep) - iKarim - 04.07.2017

Quote:
Originally Posted by Nin9r
Посмотреть сообщение
So what's the problem?
Easy improvement replace the loop with this:

for(new i = 0; i < sizeof(AdvMSG) - 1; i++)

And remove the if statement.