Raised This Month: $ Target: $400
 0% 

Reset variables with for cycle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mforce
Member
Join Date: Jan 2015
Old 10-14-2015 , 13:43   Reset variables with for cycle
Reply With Quote #1

Is it possible for reset all variables?

PHP Code:
enum PLAYER_DATABASE
{
    
STEAMID[32],
    
AWP_KILLS,
    
SCOUT_KILLS,
    
DEAGLE_KILLS,
    
USP_KILLS,
    
GLOCK_KILLS,
    
KNIFE_KILLS,
    
AWP_MENU,
    
SCOUT_MENU,
    
DEAGLE_MENU,
    
USP_MENU,
    
GLOCK_MENU,
    
KNIFE_MENU
}
new 
player_data[33][PLAYER_DATABASE];

public 
client_putinserver(id) {
    if(
is_user_bot(id)) return;
    for(new 
i=0;PLAYER_DATABASE:i<=KNIFE_MENU;PLAYER_DATABASE:i++)
        
player_data[id][PLAYER_DATABASE:i] = 0
    load
(id);

mforce is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-14-2015 , 18:19   Re: Reset variables with for cycle
Reply With Quote #2

Quote:
Originally Posted by mforce View Post
Is it possible for reset all variables?
I assume by all variables, you mean just the connecting player?

It's common practice to clear variables when the player disconnects to leave the slot clean for the next player who connects on the slot.

Try this:
PHP Code:
enum _:PLAYER_DATABASE
{
    
STEAMID[32],
    
AWP_KILLS,
    
SCOUT_KILLS,
    
DEAGLE_KILLS,
    
USP_KILLS,
    
GLOCK_KILLS,
    
KNIFE_KILLS,
    
AWP_MENU,
    
SCOUT_MENU,
    
DEAGLE_MENU,
    
USP_MENU,
    
GLOCK_MENU,
    
KNIFE_MENU
}
new 
player_data[33][PLAYER_DATABASE];

public 
client_putinserver(id
{
    if( !
is_user_botid ) )     
        
load(id);    
}  

public 
client_disconnectid )
{
    
arraysetplayer_dataid ] , sizeofplayer_data[] ) );

__________________
Bugsy is offline
mforce
Member
Join Date: Jan 2015
Old 10-16-2015 , 12:30   Re: Reset variables with for cycle
Reply With Quote #3

Thanks for your help!
mforce 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 11:17.


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