String Array 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: String Array Size (
/showthread.php?tid=635245)
String Array Size -
Novacaine - 04.06.2017
Hi everyone,
I'm trying to use iterator with string. But I have a problem with string's array size. For example; I'm adding a value to iterator, at the same time changing the value of the string that have ID with the same as iterator value.
Like;
PHP код:
new Iterator:myiter<MAX_PLAYERS>, mystr[size][24];
new id = Iter_Free(myiter);
Iter_Add(myiter, id);
format(mystr[id], 24, "%s", pName(playerid));
If i set the size of string array to MAX_PLAYERS, it will be too large. I want that the strings array as large as Iterators current size. How can i do it?
Or is there any way to make something like string Iterator?
For example;
PHP код:
Iter_Add(myiter, "test");
Re: String Array Size -
DRIFT_HUNTER - 04.06.2017
You cant, pawn does not have dynamic memory allocation. There is y_malloc include by ****** (part of YSI) and vectorial (c++ vectors) plugin for pawn. Check them out.
Re: String Array Size -
Vince - 04.06.2017
Quote:
Originally Posted by Novacaine
If i set the size of string array to MAX_PLAYERS, it will be too large.
|
A whole 96 kilobytes. Assuming that MAX_PLAYERS is still set to 1000. What is this? The 50's?