Raised This Month: $51 Target: $400
 12% 

Empty An Array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-11-2013 , 05:34   Empty An Array
Reply With Quote #1

So while i started again to Code in pawn after some months, i checked up the Funcwiki of amxmodx.org , and i noticed MANY functions are missing, so i'm not really sure , how can i empty an array and how can i copy and array to another one I mean...

i have this:

g_RoundData[FirstDimension][SecondDimension][ThirdDimension]

copy to

g_PrevRoundData[FirstDimension][SecondDimenstion][ThirdDImension]

Like

g_PrevRounData=g_RoundData..

and how to empty the current

g_RoundData...
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-11-2013 , 06:49   Re: Empty An Array
Reply With Quote #2

Something like this, I guess
PHP Code:
Set3dArray(any:array[][][], any:valuexyz)
{
    for (new 
ijkxi++)
        for (
0yj++)
            for (
0zk++)
                array[
i][j][k] = value;
                
//arrayset(array[i][j], value, z);

PHP Code:
Set3dArray(g_RoundData0sizeof g_RoundDatasizeof g_RoundData[], sizeof g_RoundData[][]); 
__________________

Last edited by hleV; 02-11-2013 at 06:52.
hleV is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-11-2013 , 07:46   Re: Empty An Array
Reply With Quote #3

Yeah i had constructed it this way but this is a bit slow, actually my array is not 3 dimension, I'm using DDimension and i have

PHP Code:
c{ new _:g_OverallData[MAXPLAYERS][Score][3]};//[User] Overall Data
c{ new _:g_RoundData[MAXPLAYERS][MAXPLAYERS][Score][2][3]};//[User] Round Data -> User ID : Victim ID : Action : Round
c{ new _:g_DamageData[MAXPLAYERS][MAXPLAYERS][g_DAction][g_DTarget][2][2][2][5]};//[User] Damage Data -> User ID : Victim ID : Taken/Made : Enemy / Ally : Weapon Index : HitPlace : Round
c{ new _:g_WeaponData[MAXPLAYERS][MAXPLAYERS][2][Score][2][2][5]};//[User] Weapon Data -> User ID : Victim ID : Weapon Index : Action : HitPlace : Round 
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 02-11-2013 at 07:47.
ProIcons is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-11-2013 , 08:01   Re: Empty An Array
Reply With Quote #4

PHP Code:
// This is specifically for an array with g_RoundData dimensions
SetDdArray(any:g{array}, any:value)
{
    for (new 
ijklmMAXPLAYERSi++)
        for (
0MAXPLAYERSj++)
            for (
0Scorek++)
                for (
02l++)
                    for (
03m++)
                        
d{array[i][j][k][l][m]} = value;

PHP Code:
SetDdArray(p{g_RoundData}, 0); 
__________________

Last edited by hleV; 02-11-2013 at 08:03.
hleV is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-11-2013 , 08:10   Re: Empty An Array
Reply With Quote #5

Well the last dimension is the size of the array, so i guess i will remove [for roundata] the last for right ?
I'm setting values with it like:
PHP Code:
d{g_RoundDatag_PlayerIDs[g_Bomb_Carrier] ][ ][ Dropped_Bomb ][ g_round ]}++; 
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 02-11-2013 at 08:11.
ProIcons is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-11-2013 , 08:37   Re: Empty An Array
Reply With Quote #6

Btw Score is ENUM
PHP Code:
enum Score 
    
Kills,
    
Deaths,
    
Assists,
    
Tks,
    
HeadShots,
    
DHeadShots,
    
Damage_n_Made,
    
Damage_n_Taken,
    
Damage_t_Made,
    
Damage_t_Taken,
    
Explodes,
    
Defuses,
    
Hostages_Saved,
    
Hostages_Attempt,
    
Hostages_Canceled,
    
Hostages_GKDE,
    
Hostages_Stole,
    
Hostages_Got_Stolen,
    
Defuses_With_Kit,
    
Defuses_Without_Kit,
    
XP,
    
Plants,
    
TeamFlashes,
    
Spawned_With_Bomb,
    
Got_Bomb,
    
Dropped_Bomb,
    
Defuse_Attempts_With_Kit,
    
Defuse_Attempts_Without_Kit,
    
Killed_Bomb_Carrier,
    
Killed_Defuser,
    
Killed_Hostage_Carrier,
    
VIP_Killed,
    
VIP_Escaped,
    
Suicides

__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Reply



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 05:26.


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