Raised This Month: $ Target: $400
 0% 

Empty an Array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-23-2011 , 05:10   Empty an Array
Reply With Quote #1

How can i empty
WeaponData[ player ][ wpnindex ][ Kills ][ half ]

without define the "wpnindex"

if in the array we have 6 different wpnindex i want to erase them an the 6 arrays...

I mean to empty all the arays that they have [player][kills][half] like i defined
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-23-2011 , 05:40   Re: Empty an Array
Reply With Quote #2

The emptying isn't a problem here but the fact that your array has four dimensions. I recommend you to use dDimension. If you need further assistance in emptying a dDimension array I will be happy to help.
SnoW is offline
Send a message via MSN to SnoW
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-23-2011 , 06:25   Re: Empty an Array
Reply With Quote #3

Arrays have always be created at the beginning of a statement ( See how the new/static must be inside the form )

if i want a global array not only to a "public" event or function what i must do...

what is: Float: fCount;

i didn't understood that f2( Float: g{ MyPassedDArray} )



also how can i empty my current array, and how can i find how many wpindexes are in my array with the same "player" "kills"
i removed the "half"
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Old 04-23-2011, 07:19
ProIcons
This message has been deleted by ProIcons. Reason: Wrong
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-23-2011 , 08:20   Re: Empty an Array
Reply With Quote #4

PHP Code:
if (TK != 1) {
            
PlayerDatakiller ][ Kills ][ half ]++;
            
PlayerDatavictim ][ Deaths ][ half ]++;
            
//WeaponData[ killer ][ wpnindex ][ Kills ][ half ]++;
            //WeaponData[ victim ][ wpnindex ][ Deaths ][ half ]++;
            
d{WeaponDatakiller ][ wpnindex ][ Kills ][ half ]} = fCount += 1.0;
            
d{WeaponDatavictim ][ wpnindex ][ Deaths ][ half ]} = fCount += 1.0;
        }
        else if (
TK == 1) {
            
PlayerDatakiller ][ Tks ][ half ]++;
            
PlayerDatavictim ][ Deaths ][ half ]++;
            
//WeaponData[ killer ][ wpnindex ][ Tks ][ half ]++;
            
dWeaponDatakiller ][ wpnindex ][ Tks ][ half ] } = fCount += 1.0;
            
//WeaponData[ victim ][ wpnindex ][ Deaths ][ half ]++;
            
dWeaponDatakiller ][ wpnindex ][ Deaths ][ half ] } = fCount += 1.0;
        }
        
msg("Kill Status: Killer: %s (%d) / Victim: %s (%d) / Weapon: %s / Hitplace: %s / TK: %d / HeadShot: %s ",killernamekillervictimnamevictimwprealnameswpnindex ], HitPlaceStringshitplace ] , TK headshot);
        
msg("Kills for Player %s with gun %s = %f",killername,wprealnameswpnindex ],dWeaponDatakiller ][ wpnindex ][ Kills ][ half ] })
        
msg("Deaths for Player %s with gun %s = %f",victimname,wprealnameswpnindex ],dWeaponDatavictim ][ wpnindex ][ Deaths ][ half ] }) 


[Network] Kill Status: Killer: ProIcons<496> ( / Victim: Test8 (4) / Weapon: Desert Eagle .50AE / Hitplace: Head / TK: 0 / H
[Network] Kills for Player ProIcons<496> with gun Desert Eagle .50 AE = 1.000000
[Network] Deaths for Player Test8 with gun Desert Eagle .50 AE = 2.000000


[Network] Kill Status: Killer: ProIcons<496> ( / Victim: Test9 (3) / Weapon: Desert Eagle .50AE / Hitplace: Head / TK: 0 / H
[Network] Kills for Player ProIcons<496> with gun Desert Eagle .50 AE = 3.000000
[Network] Deaths for Player Test9 with gun Desert Eagle .50 AE = 4.000000

It is incing the same thing....
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 04-23-2011 at 08:40.
ProIcons is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-23-2011 , 10:53   Re: Empty an Array
Reply With Quote #5

Quote:
Originally Posted by ProIcons View Post
i removed the "half"
Could you specify how many dimensions your array currently has?
SnoW is offline
Send a message via MSN to SnoW
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-23-2011 , 10:59   Re: Empty an Array
Reply With Quote #6

just see my last post...

plus this on public...
c{ new Float:WeaponData[ 33 ][ 32 ][ Score ][ 2 ] };
new Float: fCount;
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-23-2011 , 11:24   Re: Empty an Array
Reply With Quote #7

Quote:
Originally Posted by ProIcons View Post
just see my last post...

plus this on public...
c{ new Float:WeaponData[ 33 ][ 32 ][ Score ][ 2 ] };
new Float: fCount;
The variable fCount was used in the tutorial but is not otherwise related to using dDimension arrays.

You can declare the array as global but public declaration is needed only if you are going to use the array from another plugin.

Code:
c{ new _:A[ 33 ][ 32 ][ 3 ][ 2 ] }; //Global array public func( ) {      //Use the array... } func2( ) {      //Use the array... }

Notice that the array doesn't need to be Float. Use tag _: for easier operation.

Edit:

So ideally, what you would want to do is only

Code:
d{ A[ PlayerOrSomething ][ Killer ][ Weapon ][ WhatWasThis ] }++;

Last edited by SnoW; 04-23-2011 at 11:29.
SnoW is offline
Send a message via MSN to SnoW
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-23-2011 , 12:30   Re: Empty an Array
Reply With Quote #8

Ok now, how can i take from here all the arays that they have
common
killer
Deaths
half

and find the wpnindex for each ?

d{ WeaponData[ killer ][ wpnindex ][ Deaths ][ half ] }

and how can i convert a float to integer
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-23-2011 , 16:58   Re: Empty an Array
Reply With Quote #9

Quote:
Originally Posted by ProIcons View Post
Ok now, how can i take from here all the arays that they have
common
killer
Deaths
half

and find the wpnindex for each ?

d{ WeaponData[ killer ][ wpnindex ][ Deaths ][ half ] }
What you are probably trying to achieve is going through the array with a loop. I don't know what you are trying to do exactly but something similiar below.
Code:
for( int WpI; WpI < MAX; WpI++ )     if( d{ WeaponData[ Killer ][ WpI ][ Deaths ][ Half ] } == CompareTo )     {           //Action     }
Quote:
Originally Posted by ProIcons View Post
and how can i convert a float to integer
Look for floatround.
SnoW is offline
Send a message via MSN to SnoW
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-23-2011 , 18:17   Re: Empty an Array
Reply With Quote #10

and what about to remove the entry of [Killer] ?
__________________
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 19:45.


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