SA-MP Forums Archive
String too small? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: String too small? (/showthread.php?tid=88266)



String too small? - Badger(new) - 25.07.2009

For my banning system, it saves a ban text file in Scriptfiles. everything works fine, except the unban. It's meant to save everything ban line in:
pawn Код:
new resave[500][128];
The first array is 500, which is the maximum amount of bans to save, the second is the lengh of it.

This Extracts each ban line to a different resave e.g. line 1 goes to resave[0], line 2 resave[1] etc...
pawn Код:
while(fread(bans,data,sizeof(data)))
{
  if(makes sure the line isnt the player's who's being banned, but is a ban line){strmid(resave[i],data,0,sizeof(data));}
  i++;
}
But when i compile, i get this:
Код:
Header size:      3832 bytes
Code size:      288304 bytes
Data size:      345772 bytes
Stack/heap size:   16384 bytes; estimated max. usage=65840 cells (263360 bytes)
Total requirements: 654292 bytes



Re: String too small? - Correlli - 25.07.2009

You're script is using too much memory, search around, this was asked many times.

Or use this:
Quote:

#pragma dynamic value
Sets the size, in cells, of the memory block for dynamic data (the stack and the heap) to the value specified by the expression. The default size of the dynamic data block is implementation defined. An implementation may also choose to grow the block on an as-needed basis (see the host program’s documentation, or the “Implementer’s Guide” for details).




Re: String too small? - abhinavdabral - 25.07.2009

Once, It happened with me too. I fixed it by merging the loops in a Function.





Re: String too small? - Badger(new) - 25.07.2009

so would saving each ban in a separate file and then just deleting the file of the player being unbanned be a better solution?


Re: String too small? - abhinavdabral - 26.07.2009

Well Yes you can do that too but Another alternative that you have is to use DiNi for maining the Banner player Databse. its pretty easier.

Thanks And Regars
-Abhinav