I made code which randomly spawns entities from dynamic array, the problem is that when deleting from temporary array it also deletes from the main array, is it possible to clone the array or something so that the main array could not be edited, tried ArrayClone( ); but it gets undefined.
PHP Code:
new Float:Orig[ 3 ], Float:Angl[ 3 ];
new AmountCvar = get_pcvar_num( cvar_amountSpawn );
new ArraySizeBox = ArraySize( SupplyBoxes );
new size = ( AmountCvar == 0 || AmountCvar > ArraySizeBox ) ? ArraySizeBox : AmountCvar;
new Data[ SupplyBoxesArray ];
new count, randomId;
new Array:Boxes;
Boxes = SupplyBoxes;
do {
randomId = random( ArraySizeBox );
ArrayGetArray( Boxes, randomId, Data );
Orig[ 0 ] = Data[ box_origin ][ 0 ]; Angl[ 0 ] = Data[ box_angles ][ 0 ];
Orig[ 1 ] = Data[ box_origin ][ 1 ]; Angl[ 1 ] = Data[ box_angles ][ 1 ];
Orig[ 2 ] = Data[ box_origin ][ 2 ]; Angl[ 2 ] = Data[ box_angles ][ 2 ];
spawnSupplyBox( Orig, Angl, Data[ line_id ] );
count++;
ArrayDeleteItem( Boxes, randomId );
ArraySizeBox--;
} while( count < size );