SA-MP Forums Archive
[CrasDetect] Some weird warnings at my server - 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: [CrasDetect] Some weird warnings at my server (/showthread.php?tid=505860)



[CrasDetect] Some weird warnings at my server - ChristianIvann09 - 10.04.2014

How to remove this warnings [debug] caming from my server??


Код:
[18:29:52] [debug] Run time error 4: "Array index out of bounds"
[18:29:52] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:52] [debug] AMX backtrace:
[18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x425daf3e, 0x43340000) from buttons.amx
[18:29:52] [debug] Run time error 4: "Array index out of bounds"
[18:29:52] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:52] [debug] AMX backtrace:
[18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42737c0b, 0x43340000) from buttons.amx
[18:29:52] [debug] Run time error 4: "Array index out of bounds"
[18:29:52] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:52] [debug] AMX backtrace:
[18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x4284a46c, 0x43340000) from buttons.amx
[18:29:52] [debug] Run time error 4: "Array index out of bounds"
[18:29:52] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:52] [debug] AMX backtrace:
[18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x428f8ad2, 0x43340000) from buttons.amx
[18:29:52] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x429a7139, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42a5579f, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42b03e05, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42bb246c, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42c60ad2, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42d0f139, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42dbd79f, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42e6be05, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42f1a46c, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42fc8ad2, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x415eb2c2, 0x43340000) from buttons.amx
[18:29:53] [debug] Run time error 4: "Array index out of bounds"
[18:29:53] [debug]  Accessing element at index 51 past array upper bound 50
[18:29:53] [debug] AMX backtrace:
[18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44df9c75, 0xc4a2c754, 0x415a8177, 0x43870000) from buttons.amx



Re: [CrasDetect] Some weird warnings at my server - Konstantinos - 10.04.2014

Post FS_CreateButton function.


Re: [CrasDetect] Some weird warnings at my server - ChristianIvann09 - 10.04.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Post FS_CreateButton function.
Код:
forward FS_CreateButton(Float:X, Float:Y, Float:Z, Float:Angle);
public FS_CreateButton(Float:X, Float:Y, Float:Z, Float:Angle)
{
	new buttonid;

	for(buttonid = 1; buttonid <= MAX_BUTTONS; buttonid ++)
	    if (!ButtonInfo[buttonid][Created])
			break;

	ButtonInfo[buttonid][ObjectID]	= CreateObject(OBJECT,X,Y,Z,0.0,0.0,Angle);
	ButtonInfo[buttonid][Pos][0]	= X;
	ButtonInfo[buttonid][Pos][1]	= Y;
	ButtonInfo[buttonid][Pos][2]	= Z;
	ButtonInfo[buttonid][Pos][3]	= Angle;
	ButtonInfo[buttonid][Moving]	= false;
	ButtonInfo[buttonid][Created]	= true;

	for (new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
	    ButtonInfo[buttonid][Usable][playerid] = true;

	return buttonid;
}



Re: [CrasDetect] Some weird warnings at my server - Konstantinos - 10.04.2014

MAX_BUTTONS buttons is 51. A normal loop would go from 0 to 50. Your code goes from 1-51 and the last valid index is 50; hence the run time error. Use the first index and don't exceed the array's size:
Change to:
pawn Код:
for(buttonid = 0; buttonid < MAX_BUTTONS; buttonid ++)



Re: [CrasDetect] Some weird warnings at my server - ChristianIvann09 - 10.04.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
MAX_BUTTONS buttons is 51. A normal loop would go from 0 to 50. Your code goes from 1-51 and the last valid index is 50; hence the run time error. Use the first index and don't exceed the array's size:
Change to:
pawn Код:
for(buttonid = 0; buttonid < MAX_BUTTONS; buttonid ++)
Thank you very much! You are the best

+rep