Server Crashed (+ rep)
#1

Код 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;
}
Reply
#2

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

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

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 )
Reply
#4

So what's the problem?
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)