SA-MP Forums Archive
Y_INI problem... - 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: Y_INI problem... (/showthread.php?tid=611158)



Y_INI problem... - DusanInfinity - 02.07.2016

I had 70-90 players who played on my server for 5 hours, and everything is okay, but after 5 hours, Y_INI delete all player's data(who crashed/disconnected from the server), and create just blank file... What can be the problem?

Y_INI for that 5 hours work excellent, save all data, players crash/disconnect but it always save data, no problems, and after that, it start with problems... What do you think?

Can this INI_SetTag be a problem? I dont use INI_SetTag on saving...

EDIT:
Now i test anything, with 1 of that "empty" accounts, and when i want to close server, it start with spamming:
Код:
[01:41:44] [debug] Run time error 7: "Stack underflow"
[01:41:44] [debug]  Stack pointer (STK) is 0x182578, stack top (STP) is 0x182574
[01:41:44] [debug] AMX backtrace:
[01:41:44] [debug] Run time error 7: "Stack underflow"
[01:41:44] [debug]  Stack pointer (STK) is 0x18257C, stack top (STP) is 0x182574
[01:41:44] [debug] AMX backtrace:
.......



Re: Y_INI problem... - TwinkiDaBoss - 03.07.2016

Do you have anything like #pragma unused Enabled inside your script or such?

Also Ill quote ****** on this one
Quote:
Originally Posted by ******
Посмотреть сообщение
Do you get any warnings or other messages when you compile (I'm thinking specifically verbose output after the "compilation complete" message). Stack and heap problems are generally caused by calling too many functions with lots of local variables inside each other - PAWN just runs out of memory to store them.



Re: Y_INI problem... - DusanInfinity - 03.07.2016

Yep, on some commands(maybe in 20 commands of 100+) i have this(Im using y_commands):

Код:
#pragma unused help
or

Код:
#pragma unused help
	#pragma unused params
And on the end of the script, im using this for AntiDeAmx:

Код:
AntiDeAMX()
{
	new a[][] =
	{
	    "Unarmed (Fist)",
	    "Brass K"
	};
	#pragma unused a
}
Do i need to use pragma unused in every command or?


For now, i dont get any warning... But, before 1 year, i get this: https://sampforum.blast.hk/showthread.php?tid=576669

And i have used #pragma dynamic, and that message not show again...

And before a week, i just optimize my script, and i delete that #pragma dynamic, and i dont get that message on compile, now the situation is the same - i dont have #pragma dynamic, and i dont have message on compile, just 1 default message. (Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase)


Re: Y_INI problem... - TwinkiDaBoss - 03.07.2016

Well first of all regarding the pragma unused params, it actually doesnt affect anything from what I know. It just helps you get rid of warnings for example.

new myVar;
#pragma unused myVar

that would get rid of the
PHP код:
symbol is never used"myVar" 
Regarding the other problem you head with stack/heap problem, its quite simple, reduce the size of your strings.

For example what many people do is this
PHP код:
CMD:adminchat(playerid,params[]) {
    new 
text[128];
    if(
sscanf(params,"s[128]",text)) return SCM(playerid,COLOR_RED,"Usage: /adminchat [text]");
    
    
    new 
string[256];
    
format(string,sizeof(string),"Admin Chat %s",text);
    
SendAdminMessage(string);
    return 
1;

The problem would be new string[256];. You ask why? Its simple, chat can support only 128 characters therefore making a string with 256 characters is useless and it just adds up to your memory. Eventually when these "un used" characters stack up they will get you the stack/heap warning.

But yeah all in all, you have to optimize your gamemode. Reduce the string sizes that you dont need etc.


Re: Y_INI problem... - DusanInfinity - 03.07.2016

I waited for your answer, and I already start with optimizing

And i read in 1 thread, i dont rememmber that thread, but i read that chat supports 144 characters...
And my bad is that, in all commands on the top i define first strings, and then check if player can use that command:
For ex:
Код:
YCMD:sellhouse(playerid, params[],help)
{
new string[64], house = PlayerInfo[playerid][pPhousekey], kuca = ((HouseInfo[house][hCena]/100)*50);
if(house == -1) return SendClientMessage(playerid, COLOR_WHITE, "Ne posedujete kucu.");
...
And maybe that have effect for this??


Whatever, will this optimizing fix the problem with Y_INI?