Posts: 1,113
Threads: 127
Joined: Jul 2008
Reputation:
0
Hello,
The Wiki says that it only supports strings. Well since strings are arrays I tried passing an array with "s", the server crashes. As far as I know it never worked, is there any kind of workaround?
EDIT: I suppose that my server crashed because I tried passing an empty array and wiki says that it crashes when passing an empty string..
Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
Yes, arrays can be passed thru, and don't pass empty strings, use "\1" for that matter.
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
If value of index 0 (of array) is 0, it will crash the server. A workaround is to store the value of index 0 to a variable and set a value different from 0 to that index. Pass in format "si" with "s" being the array and "i" being the value of the index 0. Last, in the public function assign the old value back (if global array, don't forget to assign the old value to it as well).
EDIT: Something I didn't know about and just figured it out is that the maximum value the array can have (not referring to its size) is 255 (I guess this behavior is related to ASCII) and anything higher than that wraps around so 256 is basically 0, 257 is 1 and so on.
Posts: 1,113
Threads: 127
Joined: Jul 2008
Reputation:
0
@Konstantinos well that's quite an issue!
Posts: 294
Threads: 12
Joined: Sep 2015
Reputation:
0
no it does work i do
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#define CLF(%0) CallLocalFunction(#%0)
forward mf(a[], len);
public mf(a[], len)
{
printf("%d %d %d %d", a[0], a[1], a[2], a[3]);
}
main()
{
new a[] = {0, 1, 2, 3, 4, 5};
new b[] = {9, 8, 7, 6};
new c[] = {100, 200, 300, 400, 500};
new d[] = {111, 222, 333, 444};
CLF(mf, "ai", a, sizeof a);
CLF(mf, "ai", b, sizeof b);
CLF(mf, "ai", c, sizeof c);
CLF(mf, "ai", d, sizeof d);
}
must be "ai" not "a"