Error Stack/heap collision crashdetect
#1

PHP код:
[04:43:48] [debugRun time error 3"Stack/heap collision (insufficient stack size)"
[04:43:48] [debug]  Stack pointer (STKis 0x1BF9820heap pointer (HEAis 0x1C55D14
[04:43:48] [debugAMX backtrace:
[
04:43:48] [debug#0 002c39c8 in public cmd_muebles (playerid=0, params[]=@01c55d0c "") at C:\Users\Charlie\Desktop\Files\SAMP\gamemodes\NG.pwn:43009
[04:43:48] [debug#1 native CallLocalFunction () from samp-server.exe
[04:43:48] [debug#2 00031980 in public OnPlayerCommandText (playerid=0, cmdtext[]=@01c55ce8 "/muebles") at C:\Users\Charlie\Desktop\Files\SAMP\pawno2\include\zcmd.inc:102 
I have this error but not exactly what it should be.

The error is in this line:

Код:
CMD:muebles(playerid, params[])
{
    static
	    houseid = -1;

	if ((houseid = House_Inside(playerid)) != -1 && House_IsOwner(playerid, houseid))
	{
        new  // (( LINE 43009 )) << Error
			count = 0,
			string[MAX_FURNITURE * 32];

        for (new i = 0; i != MAX_FURNITURE; i ++) if (count < MAX_HOUSE_FURNITURE && FurnitureData[i][furnitureExists] && FurnitureData[i][furnitureHouse] == houseid) {
    		ListedFurniture[playerid][count++] = i;

    		format(string, sizeof(string), "%s%s (%.2f metros)\n", string, FurnitureData[i][furnitureName], GetPlayerDistanceFromPoint(playerid, FurnitureData[i][furniturePos][0], FurnitureData[i][furniturePos][1], FurnitureData[i][furniturePos][2]));
		}
		if (count) {
			Dialog_Show(playerid, ListedFurniture, DIALOG_STYLE_LIST, "Muebles de la casa", string, ">", "Cancelar");
     	}
     	else SendErrorMessage(playerid, "йsta casa no tiene muebles.");
	}
	else SendErrorMessage(playerid, "no estбs en el interior de tu casa.");
	return 1;
}
And also i have defined like this:
Код:
enum furnitureData {
	furnitureID,
	furnitureHouse,
	furnitureExists,
	furnitureModel,
	furnitureName[32],
	Float:furniturePos[3],
	Float:furnitureRot[3],
	furnitureObject
};
Код:
#define MAX_FURNITURE (2000)
new FurnitureData[MAX_FURNITURE][furnitureData];
Reply
#2

pawn Код:
string[MAX_FURNITURE * 32]
The size of it is 64000 and you run out of local memory. You can show 10-15 items per page in the dialog and that will reduce the size of the string. Using "static" instead of "new" might work BUT you will eventually need to reduce that size.
Reply
#3

Another way to do something like this?

I have the same error when i change to "static"

Код:
[12:15:10] [debug] Run time error 4: "Array index out of bounds"
[12:15:10] [debug] AMX backtrace:
[12:15:10] [debug] #0 00249158 in public dialog_ListedFurniture (playerid=0, response=0, listitem=0, inputtext[]=@01cf2140 "Frame 3 (3.28 metros)") at C:\Users\Charlie\Desktop\Files\SAMP\gamemodes\NG.pwn:32368
[12:15:10] [debug] #1 native CallLocalFunction () from samp-server.exe
[12:15:10] [debug] #2 0003d94c in public OnDialogResponse (playerid=0, dialogid=32700, response=0, listitem=0, inputtext[]=@01cf20e8 "Frame 3 (3.28 metros)") at C:\Users\Charlie\Desktop\Files\SAMP\pawno2\include\easyDialog.inc:131
Now the error is in this line:

Код:
Dialog:ListedFurniture(playerid, response, listitem, inputtext[])
{
	if (response)
	{
	    new id = House_Inside(playerid);

	    if (id != -1 && House_IsOwner(playerid, id))
	    {
	        PlayerData[playerid][pEditFurniture] = ListedFurniture[playerid][listitem];

			Dialog_Show(playerid, FurnitureList, DIALOG_STYLE_LIST, FurnitureData[PlayerData[playerid][pEditFurniture]][furnitureName], "Editar mueble\nRecoger mueble\nEliminar mueble", ">", "Cancel");
	    }
	}
	for (new i = 0; i != MAX_FURNITURE; i ++) //  (( Error )) <<<
	{
	    ListedFurniture[playerid][i] = -1;
	}
	return 1;
}
Код:
new ListedFurniture[MAX_PLAYERS][MAX_HOUSE_FURNITURE];
Reply
#4

Yes, it's called pagination. This subforum has about 100k threads which aren't shown on a single page, either.
Reply
#5

Try for (new i = 0; i < MAX_FURNITURE; i++)

Anyway, instead of displaying everything in one big dialog, do as Vince said, pagination. Split it up into pages. Like show 20 furniture per page.
Reply
#6

Quote:
Originally Posted by Kar
Посмотреть сообщение
Try for (new i = 0; i < MAX_FURNITURE; i++)

Anyway, instead of displaying everything in one big dialog, do as Vince said, pagination. Split it up into pages. Like show 20 furniture per page.
sorry for my ignorance , but how could I do this ?, if you have a tutorial it will be great.
Reply
#7

PHP код:
//You Script

#pragma dynamic (128*1024) //128 KB 
Reply
#8

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
//You Script
#pragma dynamic (128*1024) //128 KB 
Let's not do this...
Reply
#9

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
//You Script
#pragma dynamic (128*1024) //128 KB 
Unnecessary.
Reply
#10

What i can do to show in one big dialog? or do something to show all the objects.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)