Raised This Month: $ Target: $400
 0% 

event_round_start dont work (?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 03-24-2009 , 18:48   event_round_start dont work (?)
Reply With Quote #1

hello , i made this code [credits to connormcleod]
but when round end i still have fast attack rate whit knife
please someone fix it

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Carnicero!"
#define VERSION "1.0"
#define AUTHOR "AlejandroSk & alan_el_more credits ConnorMcLeod"

#define    m_flNextPrimaryAttack    46 
#define    m_flNextSecondaryAttack    47 
#define    m_flTimeWeaponIdle        48 

new g_itemid1bool:g_HasCarnicero[33]
new 
cvar_attack1ratecvar_attack2ratecvar_costcvar_togglecvar_message

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
cvar_cost register_cvar("zp_carnicero_cost""15")
    
cvar_toggle register_cvar("zp_carnicero_enabled""1")
    
cvar_attack1rate register_cvar("zp_carnicero_attack1_rate""0.1")
    
cvar_attack2rate register_cvar("zp_carnicero_attack2_rate""0.8")
    
cvar_message register_cvar("zp_carnicero_hudmessage""1")
    
g_itemid1 zp_register_extra_item("Carnicero"get_pcvar_num(cvar_cost), ZP_TEAM_HUMAN)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""Knife_PrimaryAttack"1
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""Knife_SecondaryAttack"1)
}

public 
client_connect(id)
{
    
g_HasCarnicero[id] = false
}

public 
zp_extra_item_selected(iditemid)
{
    if (
itemid == g_itemid1)
    {
        if (
get_pcvar_num(cvar_toggle))
        {
            
        
g_HasCarnicero[id] = true
        client_print
(id,print_chat"Te Convertiste En Un Carnicero!")
        
fm_set_user_armor(id500)
        new 
name[32]
        
get_user_name(idname31)
        if (
get_pcvar_num(cvar_message))
        {
        
set_hudmessage(255000.030.4306.012.0)
        
show_hudmessage(id":: %s Se Ha Comprado Un Carnicero ::"name)
        }
        
        }
    }
}

public 
Knife_PrimaryAttackiEnt 

    static 
Float:flRate flRate get_pcvar_float(cvar_attack1rate)
    static 
id id peviEnt pev_owner );
    
    if (!
g_HasCarnicero[id] == true)
    {
    
set_pdata_float(iEntm_flNextPrimaryAttack1.04
    
set_pdata_float(iEntm_flNextSecondaryAttack1.04
    
set_pdata_float(iEntm_flTimeWeaponIdle1.04
    }
    else {
        
set_pdata_float(iEntm_flNextPrimaryAttackflRate4
        
set_pdata_float(iEntm_flNextSecondaryAttackflRate4
        
set_pdata_float(iEntm_flTimeWeaponIdleflRate4
    }


public 
Knife_SecondaryAttackiEnt )

    static 
Float:flRate flRate get_pcvar_float(cvar_attack2rate)
    static 
id id peviEnt pev_owner )
    
    if (!
g_HasCarnicero[id] == true)
    {
    
set_pdata_float(iEntm_flNextPrimaryAttack1.04
    
set_pdata_float(iEntm_flNextSecondaryAttack1.04
    
set_pdata_float(iEntm_flTimeWeaponIdle1.04)
    }
    else {
        
set_pdata_float(iEntm_flNextPrimaryAttackflRate4
        
set_pdata_float(iEntm_flNextSecondaryAttackflRate4
        
set_pdata_float(iEntm_flTimeWeaponIdleflRate4)
    }
}
    
public 
event_round_start(id)
{
    
g_HasCarnicero[id] = false
}
        
stock fm_set_user_armor(indexarmor
{
    
set_pev(indexpev_armorvaluefloat(armor));

AlejandroSk is offline
Send a message via MSN to AlejandroSk
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 03-24-2009 , 18:59   Re: event_round_start dont work (?)
Reply With Quote #2

PHP Code:
public event_round_start() 

       for(new 
1<= 32i++)
               
g_HasCarnicero[i] = false 

__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 03-24-2009 , 19:03   Re: event_round_start dont work (?)
Reply With Quote #3

Quote:
Originally Posted by AntiBots View Post
PHP Code:
public event_round_start() 

       for(new 
1<= 32i++)
               
g_HasCarnicero[i] = false 

Yes! That is the right way to do it because the round_start event is global.
That means that it is only one general event! It isn't called on every player.
So that is why you need to use the for cycle and set g_HasCarnicero[i] to false
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 03-24-2009 , 20:20   Re: event_round_start dont work (?)
Reply With Quote #4

thank you all guys!
AlejandroSk is offline
Send a message via MSN to AlejandroSk
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-25-2009 , 10:58   Re: event_round_start dont work (?)
Reply With Quote #5

Or then you can use Ham_Spawn.
SnoW is offline
Send a message via MSN to SnoW
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 08:52.


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