AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   int not reseting by rounds end (https://forums.alliedmods.net/showthread.php?t=100596)

darkd 08-16-2009 03:23

int not reseting by rounds end
 
Hey there, im having a problem, the int i created doesn't reset at rounds end. Can somebody help me?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "smartAwp"
#define VERSION "1.0"
#define AUTHOR "DarkD"

new smartawp_enable
new awpTry


public plugin_init() {
    
register_plugin("smartAwp""1.0""DarkD")
    
smartawp_enable register_cvar("smartawp_enable""1")
    
register_clcmd("say /awp""smartAwp");
    
register_event("HLTV""event_new_round""a""1=0""2=0")  
    
}

public 
HLTV() {
    
awpTry 0;
}

public 
smartAwp(id){
    if ( !
is_user_alive(id) ) return PLUGIN_HANDLED;
    
    if(
get_pcvar_num(smartawp_enable)==1) {
        if(
awpTry == 0) {
            switch ( 
random_num(03) )
            {
                case 
0client_print(idprint_chat"Sorry, no AWP for you this round.");
                    case 
1client_print(idprint_chat"Sorry, no AWP for you this round.");
                    case 
2client_print(idprint_chat"Sorry, no AWP for you this round.");
                    case 
3give_item(id"weapon_awp");
                }
            
awpTry 1;
            } else if(
awpTry == 1) {
            
client_print(idprint_chat"You already tryed to get a awp this round!");
        }
        } else if(
get_pcvar_num(smartawp_enable)==0) {
        
client_print(idprint_chat"This plugin is disabled.");
    }
    return 
PLUGIN_CONTINUE;        



jim_yang 08-16-2009 04:38

Re: int not reseting by rounds end
 
public HLTV => public event_new_round
new awpTry => new awpTry[33]
awpTry => awpTry[id]

xPaw 08-16-2009 04:39

Re: int not reseting by rounds end
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

new smartawp_enable
new bool:awpTry33 ];

public 
plugin_init( ) {
    
register_plugin"smartAwp""1.0""DarkD" )
    
smartawp_enable register_cvar"smartawp_enable""1" )
    
register_clcmd"say /awp""smartAwp" );
    
register_event"HLTV""event_new_round""a""1=0""2=0" )  
    
}

public 
event_new_round( ) {
    
arraysetawpTryfalse32 );
}

public 
smartAwpid ) {
    if ( !
is_user_aliveid ) ) return PLUGIN_HANDLED;
    
    if( 
get_pcvar_numsmartawp_enable ) ) {
        if( !
awpTryid ] ) {
            if( 
random_num0) == )
                
give_itemid"weapon_awp" );
            else
                
client_printidprint_chat"Sorry, no AWP for you this round." );
            
            
awpTryid ] = true;
        } else
            
client_printidprint_chat"You already tryed to get a awp this round!" );
    } else
        
client_printidprint_chat"This plugin is disabled." );
    
    return 
PLUGIN_CONTINUE;        



darkd 08-16-2009 04:40

Re: int not reseting by rounds end
 
amazing, thanks xPaw!


All times are GMT -4. The time now is 15:12.

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