SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 21/05/2018, 06:41 PM   #1
ohmy
Big Clucker
 
Join Date: Aug 2014
Location: Indonesia
Posts: 57
Reputation: 1
Default AMX Backtrace help

As the title says, here's the code

Code:
if(dialogid == 10000)
    {
		if(response)
		{
        if(listitem == 0)
        {
            for(new i=0; i < MAX_DROPPED_ITEMS; i++)
            {
                if(DroppedItem[i][dItemAmount] == 0)
                {
					new Float:x, Float:y, Float:z;
					GetPlayerPos(playerid, x, y, z);
					DroppedItem[i][dItemX] = x;
					DroppedItem[i][dItemY] = y;
					DroppedItem[i][dItemZ] = z;
					GetPVarString(playerid, "SelectedItem", DroppedItem[i][dItemName], 32);
					for(new f=0; f < MAX_INVENTORY; f++)
					{
						if(!strcmp(DroppedItem[i][dItemName], PlayerInventory[playerid][f][pItemName]))
						{
							DroppedItem[i][dItemAmount] = PlayerInventory[playerid][f][pItemAmount];
							PlayerInventory[playerid][f][pItemAmount] = 0;
							format(PlayerInventory[playerid][f][pItemName], 32, "");
							new strings[64];
							format(strings, 64, ""COL_LIGHTGREEN"Drop %s, Amount %d", DroppedItem[i][dItemName], DroppedItem[i][dItemAmount]);
							SendClientMessage(playerid, -1, strings);
							SaveDroppedItems();
							return 1;
						}
					}
					return 1;
				}
			}
		}
		}
	}
MAX_DROPPED_ITEMS is 500
MAX_INVENTORY is 15
(The code gets un neat when i pasted it)

Code:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 50 past array upper bound 49
[debug] AMX backtrace:
[debug] #0 000c7868 in ?? () from NOTGM.amx
[debug] #1 00052000 in ?? (2, 10000, 1, 0, 29539412) from NOTGM.amx
[debug] #2 0000f0f0 in public OnDialogResponse (2, 10000, 1, 0, 29539412) from NOTGM.amx
ohmy is offline   Reply With Quote
Old 22/05/2018, 06:04 AM   #2
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 325
Reputation: 43
Default Re: AMX Backtrace help

You'll find your fix here.

http://forum.sa-mp.com/showthread.php?t=654036

Also, Try using debug level 3, so it shows you the exact lines that produce the crash.
If you don't know how to do that, here's how:
You should create a file called pawn.cfg in your pawno folder, inside this file write:

PHP Code:
-d3 
Save the file and recompile your script and run it with crashdetect again.

And then show us the exact line that caused the crash. It should be a for loop most of the time.
DarkSkull 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
AMX backtrace Wahyu33 Scripting Help 4 23/02/2017 02:52 PM
AMX backtrace Auri Scripting Help 3 02/02/2016 11:32 AM
AMX Backtrace [+Rep] RayC Scripting Help 2 04/01/2015 07:51 PM


All times are GMT. The time now is 04:32 PM.


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