SA-MP Forums Archive
Stack/heap collision (insufficient stack size) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stack/heap collision (insufficient stack size) (/showthread.php?tid=618752)



Stack/heap collision (insufficient stack size) - nerovani - 09.10.2016

Triggering this:

Код:
CMD:loadpass(playerid)
{
new query[120],pName[MAX_PLAYER_NAME],string[124];
GetPlayerName(playerid,pName,sizeof(pName));
format(query, sizeof(query), "SELECT * FROM `users` WHERE `Username` = '%s'", pName);
mysql_query(query);
mysql_store_result();
new field[58][120],row[128];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
mysql_free_result();
PlayerInfo[playerid][pPass] = strval(field[3]);
format(string,sizeof(string),"%d",PlayerInfo[playerid][pPass]); SendClientMessage(playerid,-1,string);
return 1;
}
Keeps showing me this in the console:

Код:
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x1B063EC, heap pointer (HEA) is 0x1B096B8
[debug] AMX backtrace:
[debug] #0 00000000 in public cmd_loadpass () from maintest.amx
[debug] #1 native CallLocalFunction () from samp-server.exe
[debug] #2 00000000 in public OnPlayerCommandText () from maintest.amx
Any suggestions that might help? Much appreciated.


Re: Stack/heap collision (insufficient stack size) - Vince - 09.10.2016

Yes, I suggest you not invade player's privacy.


Re: Stack/heap collision (insufficient stack size) - nerovani - 09.10.2016

The password is getting hashed upon registration. Maybe you didn't notice that it's a number, not a string.

Anyway, I fixed the problem, just used #pragma to increase the space


Re: Stack/heap collision (insufficient stack size) - azzerking - 09.10.2016

Pretty certain using #pragma for anything is bad practice, i'm not 100% sure, which ones or are not bad practice but maybe Vince could explain better on that.

I never had to use #pragma for anything.