CreateDynamicPolygon problem -
zgintasz - 02.04.2012
Hi guys,
I'm using this streamer and I need help:
https://sampforum.blast.hk/showthread.php?tid=102865
I want to create areas with
CreateDynamicPolygon function. Here is my script:
Code:
new
Float:vertexai[ ][ ] =
{
// coords
{-3264.850341, 1881.825683,
-3298.238769, -3066.096191,
760.000000, -2860.000000,
-52.000000, -1894.000000,
24.250000, -1634.015625,
65.000000, -1411.092285,
33.000000, -1249.550781,
107.000000, -1158.429687,
47.000000, -1098.135498,
102.000000, -920.469970,
-57.000000, -902.997314,
-124.000000, -857.887939,
-181.000000, -784.712402,
-293.000000, -350.712402,
-776.000000, -323.554443,
-1042.000000, -318.570068,
-1009.000000, 265.434570,
-841.000000, 461.434570,
-1058.078125, 670.094238,
-1561.000000, 1582.991821,
-3264.850341, 1881.825683
},
// another coords
{ -2264.850341, 881.825683,
-2298.238769, -2066.096191,
760.000000, -1860.000000,
-52.000000, -894.000000,
-2264.850341, 881.825683
}
}
;
// Loading:
new
polygons[ 2 ]
;
for( new i; i < sizeof( vertexai ); i++ )
{
polygons[ i ] = CreateDynamicPolygon( vertexai[ i ] );
}
But I get this warning:
warning 224: indeterminate array size in "sizeof" expression (symbol "maxpoints")
How to solve that?
Thank you very much!
Re: CreateDynamicPolygon problem -
TheArcher - 02.04.2012
Well sizeof returns the size in elements of an array. vertexai has 2D array form so it doesn't know what array to extract.
Example of usage:
pawn Code:
new test[4];
for( new i; i < sizeof( test); i++ ) { printf(" %d ", test); }
it unpacks "4".
2D
pawn Code:
new
test[5][10];
printf("%d %d", sizeof (test), sizeof (test[]));
Re: CreateDynamicPolygon problem -
zgintasz - 02.04.2012
Thanks for your reply, but I don't understand what I have to do... Can you give me a solved code?
I replaced
polygons[ i ] = CreateDynamicPolygon( vertexai[ i ] );
with
polygons[ i ] = CreateDynamicPolygon( vertexai[ i ][ ] );
but then I get this error :/ :
error 029: invalid expression, assumed zero
Re: CreateDynamicPolygon problem -
TheArcher - 02.04.2012
well i've tried to do in this way quickly
pawn Code:
#define points_size (26+1)// i tried to do it manualy beacuse the array has known array size
new Float:vertexai[ ][ ] =
{
// coords
{-3264.850341, 1881.825683,
-3298.238769, -3066.096191,
760.000000, -2860.000000,
-52.000000, -1894.000000,
24.250000, -1634.015625,
65.000000, -1411.092285,
33.000000, -1249.550781,
107.000000, -1158.429687,
47.000000, -1098.135498,
102.000000, -920.469970,
-57.000000, -902.997314,
-124.000000, -857.887939,
-181.000000, -784.712402,
-293.000000, -350.712402,
-776.000000, -323.554443,
-1042.000000, -318.570068,
-1009.000000, 265.434570,
-841.000000, 461.434570,
-1058.078125, 670.094238,
-1561.000000, 1582.991821,
-3264.850341, 1881.825683
},
// another coords
{ -2264.850341, 881.825683,
-2298.238769, -2066.096191,
760.000000, -1860.000000,
-52.000000, -894.000000,
-2264.850341, 881.825683
}
};
// Loading:
new
polygons[ 2 ]
;
for( new i; i < sizeof(vertexai); i++ )
{
polygons[ i ] = CreateDynamicPolygon(vertexai [ i ], vertexai[ i ][0], vertexai[ i ][1], points_size);
}
P.S not tested