Crashdetect (debug)
#1

[11:28:19] [debug] AMX backtrace:
[11:28:19] [debug] #0 000bdf90 in ?? (... <5 arguments>) at G:\ZS\gamemodes\gamemodes\gamemodes\bttdmzmapocaly pse.pwn:8900
[11:28:19] [debug] #1 000130ac in public OnPlayerGiveDamage (playerid=37, damagedid=166, Float:amount=0.00000, weaponid=1196588, bodypart=589824) at G:\ZS\pawno\include\YSI\y_hooks/impl.inc:2396
[11:28:19] [debug] Run time error 4: "Array index out of bounds"
[11:28:19] [debug] Accessing element at index 167 past array upper bound 99
[11:28:19] [debug] AMX backtrace:
[11:28:19] [debug] #0 000be334 in ?? (... <5 arguments>) at G:\ZS\gamemodes\gamemodes\gamemodes\bttdmzmapocaly pse.pwn:8930
[11:28:19] [debug] #1 00012f00 in public OnPlayerTakeDamage (playerid=37, issuerid=167, Float:amount=0.00000, weaponid=1655482, bodypart=458752) at G:\ZS\pawno\include\YSI\y_hooks/impl.inc:2349
[11:28:19] [debug] Run time error 4: "Array index out of bounds"
[11:28:19] [debug] Accessing element at index 168 past array upper bound 99

Code:

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(playerid != INVALID_PLAYER_ID)
 	{ 
 	    if(team[playerid] != team[damagedid]) // Line 8900
 	    {
			//code
		}
		if(team[playerid] == TEAM_HUMAN)
		{
			if(team[damagedid] == TEAM_ZOMBIE)
			{
                if(IsPlayerInRangeOfPoint(damagedid, 7.0,Map[P],Map[Q],Map[R]))
				{
					if(team[playerid] == TEAM_HUMAN)
					{
                                       //code
					}
				}
			}
		}
	}
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid , bodypart)
{
    DamageTaken[playerid] = 1;
    new Float:hp;
	if(issuerid != INVALID_PLAYER_ID)
  	{
  	PlayerShotPlayer[issuerid][playerid] = 1; // Line 8930
        }
        return 1;
}

Also how to prevent this:
[09:40:34] [debug] Run time error 4: "Array index out of bounds"
[09:40:34] [debug] Accessing element at index 32 past array upper bound 31
[09:40:34] [debug] AMX backtrace:
[09:40:34] [debug] #0 000007d0 in public OnPlayerCommandText (playerid=28, cmdtext[]=@01134200 "/pizzajob/pizzajob/pizzajob/pizzajob") at G:\ZS\pawno\include\zcmd.inc:94

This guy types incorrect command with more slashes as the actual command is /pizzajob
Reply
#2

Two lines above 8900, the correct check would be:
Код:
if(damagedid != INVALID_PLAYER_ID)
instead of playerid.

---

In line 8930, the size of "PlayerShotPlayer" seems to be 100 but the ID issuer had is 167. Set correct size for it, the max slots of your server.

---

About the last run time error 4: http://forum.sa-mp.com/showpost.php?...&postcount=482
Find this line in zcmd.inc file:
pawn Код:
funcname[pos-1] = tolower(cmdtext[pos]);
and add the if/else statements like in the post linked above.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Two lines above 8900, the correct check would be:
Код:
if(damagedid != INVALID_PLAYER_ID)
instead of playerid.

---

In line 8930, the size of "PlayerShotPlayer" seems to be 100 but the ID issuer had is 167. Set correct size for it, the max slots of your server.

---

About the last run time error 4: http://forum.sa-mp.com/showpost.php?...&postcount=482
Find this line in zcmd.inc file:
pawn Код:
funcname[pos-1] = tolower(cmdtext[pos]);
and add the if/else statements like in the post linked above.
Thanks and how can issuer id go to 167 when there cannot be more than 100 players

Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 100

new PlayerShotPlayer[MAX_PLAYERS][MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)