server_cfg warnings
#1

Hi there ! I received it in server_logs.cfg:

"
[20:00:54] [debug] Run time error 4: "Array index out of bounds"
[20:00:54] [debug] Accessing element at index 25 past array upper bound 24
[20:00:54] [debug] AMX backtrace:
[20:00:54] [debug] #0 001140f8 in public IsPlayerInTurf (playerid=88, turfid=25) at D:\server\gmi.pwn:19944
[20:00:54] [debug] #1 0016e004 in public AB_OnPlayerDeath (playerid=88, killerid=41, reason=34) at D:\server\gmi.pwn:26389
[20:00:54] [debug] #2 0001fbf0 in public OnPlayerDeath (playerid=88, killerid=41, reason=34) at D:\server\pawno\include\OPA.inc:71
"

Script:
Код HTML:
public IsPlayerInTurf(playerid, turfid)
{
		if(turfid == -1)
		{
			return 0;
		}
		new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid,x,y,z);
		if(x >= TurfInfo[turfid][zMinX] && x < TurfInfo[turfid][zMaxX] && y >= TurfInfo[turfid][zMinY] && y < TurfInfo[turfid][zMaxY])
		{
	 		return 1;
		}
	return 0;
}
Line 19944: if(x >= TurfInfo[turfid][zMinX] && x < TurfInfo[turfid][zMaxX] && y >= TurfInfo[turfid][zMinY] && y < TurfInfo[turfid][zMaxY])

Line 26389: if(IsPlayerInTurf(playerid, i))
Some lines before and after
"
Код HTML:
for(new i = 0; i <= sizeof(TurfInfo); i++)
			{
			    if(IsPlayerInTurf(playerid, i))
			    {
			        if(killerid != INVALID_PLAYER_ID)
			        {
					new string[144];
		    		if(WarInfo[i][wTime] > 0)
				{if(i == i)
					{
"

Line 71 from OPA.inc: return 1;

Entire public:
"
Код HTML:
public OnPlayerDeath(playerid, killerid, reason)
{
	g_abLastTick[playerid] = gettime() + 3;

	#if defined AB_OnPlayerDeath
	    AB_OnPlayerDeath(playerid, killerid, reason);
	#endif
	return 1;
}
How can I fix them?
"
Reply
#2

pawn Код:
for(new i = 0; i <= sizeof(TurfInfo); i++)
//to
for(new i = 0; i < sizeof(TurfInfo); i++)
Reply
#3

Also, I am using it:
Код HTML:
enum zInfo
{
	zID,
	zOwned,
	zTime,
    Float:zMinX,
    Float:zMinY,
    Float:zMaxX,
    Float:zMaxY,
};
new TurfInfo[25][zInfo];
new Turfs[25];
And I have just 24 turfs in database. Is it ok?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)