SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/08/2016, 10:29 AM   #1
Penguin1997
Big Clucker
 
Join Date: Dec 2014
Location: BTTDM Zombie Survival
Posts: 69
Reputation: 4
Default Crashdetect (debug)

[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:

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
Penguin1997 is offline   Reply With Quote
Old 24/08/2016, 11:07 AM   #2
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,831
Reputation: 1401
Default Re: Crashdetect (debug)

Two lines above 8900, the correct check would be:
Code:
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 Code:
funcname[pos-1] = tolower(cmdtext[pos]);
and add the if/else statements like in the post linked above.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 24/08/2016, 11:32 AM   #3
Penguin1997
Big Clucker
 
Join Date: Dec 2014
Location: BTTDM Zombie Survival
Posts: 69
Reputation: 4
Default Re: Crashdetect (debug)

Quote:
Originally Posted by Konstantinos View Post
Two lines above 8900, the correct check would be:
Code:
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 Code:
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

Code:
#undef MAX_PLAYERS
#define MAX_PLAYERS 100

new PlayerShotPlayer[MAX_PLAYERS][MAX_PLAYERS];
Penguin1997 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
crashdetect debug help kampuman Scripting Help 4 22/07/2016 09:39 PM
Debug Crashdetect Nin9r Server Support 12 21/09/2015 12:02 PM
Debug CrashDetect qmnty Scripting Help 0 07/05/2014 02:13 AM
[Ajuda] debug crashdetect AndersonAq PortuguÍs/Portuguese 7 05/04/2014 11:38 AM
Crashdetect debug mirou123 Scripting Help 2 01/03/2014 01:13 PM


All times are GMT. The time now is 08:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.