Raised This Month: $ Target: $400
 0% 

Clone dynamic array


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DavidLin
Member
Join Date: Jan 2016
Old 01-31-2016 , 11:45   Clone dynamic array
Reply With Quote #1

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], Float:Angl];
        new 
AmountCvar   get_pcvar_numcvar_amountSpawn );
        new 
ArraySizeBox ArraySizeSupplyBoxes );
        new 
size = ( AmountCvar == || AmountCvar ArraySizeBox ) ? ArraySizeBox AmountCvar;
        new 
DataSupplyBoxesArray ];
        new 
countrandomId;
        new Array:
Boxes;
        
Boxes SupplyBoxes;

        do {
                
randomId randomArraySizeBox );
                
ArrayGetArrayBoxesrandomIdData );
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
spawnSupplyBoxOrigAnglDataline_id ] );
                
count++;

                
ArrayDeleteItemBoxesrandomId );
                
ArraySizeBox--;
        } while( 
count size ); 
DavidLin is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode