AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Empty An Array (https://forums.alliedmods.net/showthread.php?t=208233)

ProIcons 02-11-2013 05:34

Empty An Array
 
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...

hleV 02-11-2013 06:49

Re: Empty An Array
 
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[][]); 


ProIcons 02-11-2013 07:46

Re: Empty An Array
 
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 


hleV 02-11-2013 08:01

Re: Empty An Array
 
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); 


ProIcons 02-11-2013 08:10

Re: Empty An Array
 
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 ]}++; 


ProIcons 02-11-2013 08:37

Re: Empty An Array
 
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




All times are GMT -4. The time now is 20:39.

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