Raised This Month: $ Target: $400
 0% 

help w/ reset array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fmcTheKing
Member
Join Date: Feb 2011
Location: Brazil
Old 09-25-2011 , 03:53   help w/ reset array
Reply With Quote #1

how best to reset this:
PHP Code:
enum GLOBAL_STATS
{
    
global_frags 0,        
    
global_deaths,
    
global_assists,            
    
global_headshots,
    
global_damage,            
    
global_roundsplayed,
    
global_bombsplanted,        
    
global_bombsdefusals,
    
global_timeplayed,        
    
global_roundswon,
    
global_roundsloses,        
    
global_matcheswon,
    
global_matchesloses,
    
global_matchesties,
    
global_1k,
    
global_2k,
    
global_3k,
    
global_4k,
    
global_5k,
    
global_1v1,
    
global_1v2,
    
global_1v3,
    
global_1v4,
    
global_1v5
}

new 
g_Global_Stats33 ][ GLOBAL_STATS 
if I try this:
PHP Code:
for(new GLOBAL_STATS i++){
    
g_Global_Stats[id][i] = 0

results in this:

Quote:
Warning: Tag mismatch on line 148
Warning: Index tag mismatch (symbol "g_Global_Stats") on line 149
__________________


Last edited by fmcTheKing; 09-27-2011 at 23:22.
fmcTheKing is offline
Send a message via MSN to fmcTheKing Send a message via Skype™ to fmcTheKing
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-25-2011 , 04:07   Re: help w/ reset array
Reply With Quote #2

Try :

enum GLOBAL_STATS

->

enum _:GLOBAL_STATS

PHP Code:
for(new GLOBAL_STATS i++){
    
g_Global_Stats[id][i] = 0


And if you need to reset all players, try this :
PHP Code:
new g_iMaxPlayers

public plugin_init()
{
    
g_iMaxPlayers get_maxplayers()
}

public 
ResetStats()
{
    for(new 
id=1id<=g_iMaxPlayersid++)
    {
        
arrayset(g_Global_Stats[id], 0sizeof(g_Global_Stats[]))
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-25-2011 at 04:13.
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-25-2011 , 04:39   Re: help w/ reset array
Reply With Quote #3

For functions like arrayset() which takes an array with no tag, you should avoid to have have a strong tag (first letter in uppercase).
__________________
Arkshine is offline
fmcTheKing
Member
Join Date: Feb 2011
Location: Brazil
Old 09-25-2011 , 17:26   Re: help w/ reset array
Reply With Quote #4

hmmm, I understood, thanks.
__________________

fmcTheKing is offline
Send a message via MSN to fmcTheKing Send a message via Skype™ to fmcTheKing
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:43.


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