29.05.2009, 08:06
How to get the size of an array passed to a native function?
Let's say i have this native definition in the pwn file:
I need the size of a1 and a2 (2 and 4 in this example), in my plugin. How to do this?
I know a trick to get the size of ONE array if there is only one argument in the native definition, but for 2 arrays as 2 different arguments, i'm stuck!
Edit: ok i can get the size of the first array by doing this:
So this is basically all i needed, but if i could get the size of a2 it still would be nice...
Let's say i have this native definition in the pwn file:
pawn Code:
native Bla(a1[], a2[]);
//then i use like this:
Bla( {1, 13}, {2, 3, 1, 7} );
I know a trick to get the size of ONE array if there is only one argument in the native definition, but for 2 arrays as 2 different arguments, i'm stuck!
Edit: ok i can get the size of the first array by doing this:
pawn Code:
static cell AMX_NATIVE_CALL Bla(AMX *amx, cell *p)
{
printf("sizeof a1 = %d\n", (p[2]-p[1])/4);
//printf("sizeof a2 = %d\n", ?????);
return 0;
}