View Single Post
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 03-30-2014 , 17:52   Re: Weapon Balance Mod
Reply With Quote #26

Thx, i have another question if i want to use the double shot on attack2 (i mean when player press right click use the double shot, i dont want to hold down secondary attack and then press primary attack to use it) i can change to secondary attack right? or i need to use CmdStart?

this is fine?

PHP Code:
public OnCmdStart(iduc_handleseed
{   
      if ( ! 
is_user_alive(id) )
        return;

        static 
buttonsoldbuttons
        buttons 
get_uc(uc_handleUC_Buttons);
        
oldbuttons pev(idpev_oldbuttons);
      
        if( ( 
buttons IN_ATTACK2 ) && !( oldbuttons IN_ATTACK2 ) ) 
        {
    
        static 
iEnt
        iEnt 
find_ent_by_owner(-1"weapon_m3"id)

        if( 
g_iOldClip>get_pdata_int(iEntm_iClip4) )
     {
        
g_fLastAttack[g_iShotgunOwner] = (get_gametime()+0.5);
        
        if( !
g_bDoubleShot )
            {
            if( 
g_iOldClip>&& get_pcvar_num(g_iCvarShotGunDoubleShot) && pev(g_iShotgunOwnerpev_button)&IN_ATTACK2 && g_bHasUltraM3[g_iShotgunOwner])
            {                
                static 
Float:s_fAngleDifferenceFloat:s_fOldAngle;
                
set_pdata_float(iEntm_flNextPrimaryAttack0.04);
                
set_pdata_float(iEntm_flNextSecondaryAttack0.04);
                
set_pev(g_iShotgunOwnerpev_punchangleg_fBackupAngle);
                
s_fOldAngle g_fBackupAngle[0];
                
g_bDoubleShot true;
                
ExecuteHamB(Ham_Weapon_PrimaryAttackiEnt);
                
g_bDoubleShot false;
                
pev(g_iShotgunOwnerpev_punchangleg_fBackupAngle);
                
s_fAngleDifference = (g_fBackupAngle[0]-s_fOldAngle);    
                
set_pdata_float(iEntm_flNextPrimaryAttack2.004);
                
set_pdata_float(iEntm_flNextSecondaryAttack2.004);
                if( 
g_fBackupAngle[0]>-25.0 && g_fBackupAngle[0]<0.0 )
                {
                    
s_fAngleDifference *= 2.1;
                    
g_fBackupAngle[0] = (s_fOldAngle+s_fAngleDifference);
                    if( 
g_fBackupAngle[0]<-25.0 )
                        
g_fBackupAngle[0] = -25.0;
                    
set_pev(g_iShotgunOwnerpev_punchangleg_fBackupAngle);
                }
                
                }
            }            
        }
    }


Last edited by wicho; 03-30-2014 at 19:30.
wicho is offline