Raised This Month: $ Target: $400
 0% 

cs_get_weapon_silen >> in fakemeta


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-08-2009 , 08:41   Re: cs_get_weapon_silen >> in fakemeta
Reply With Quote #2

PHP Code:
#define EXTRAOFFSET_WEAPONS 4

#define OFFSET_WEAPONTYPE            43
#define OFFSET_SILENCER_FIREMODE    74

#define M4A1_SILENCED                    (1<<2)
#define M4A1_ATTACHSILENCEANIM            6
#define M4A1_DETACHSILENCEANIM            13
#define USP_SILENCED                    (1<<0)
#define USP_ATTACHSILENCEANIM            7
#define USP_DETACHSILENCEANIM            15

#define GLOCK_SEMIAUTOMATIC                0
#define GLOCK_BURSTMODE                    2
#define FAMAS_AUTOMATIC                    0
#define FAMAS_BURSTMODE                    16

#define cs_get_weapon_id(%1) get_pdata_int(%1,OFFSET_WEAPONTYPE,EXTRAOFFSET_WEAPONS)

stock cs_get_weapon_silenced(index)
{
    switch( 
cs_get_weapon_id(index) )
    {
        case 
CSW_M4A1:
        {
            return (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) & M4A1_SILENCED);
        }
        case 
CSW_USP:
        {
            return (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) & USP_SILENCED);
        }
    }
    return 
0;
}

stock cs_get_weapon_burstmode(index)
{
    switch(
cs_get_weapon_id(index))
    {
        case 
CSW_GLOCK18:
        {
            return (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) == GLOCK_BURSTMODE);
        }
        case 
CSW_FAMAS:
        {
            return (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) == FAMAS_BURSTMODE);
        }
    }
    return 
0;
}

stock cs_set_weapon_silen(indexsilence 1draw_animation 1)
{
    switch(
cs_get_weapon_id(index))
    {
        case 
CSW_M4A1:
        {
            new 
silencemode get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS);
            if(
silence)
            {
                if (!(
silencemode M4A1_SILENCED)) 
                {
                    
silencemode |= M4A1_SILENCED;
                    
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,silencemode,EXTRAOFFSET_WEAPONS);

                    if (
draw_animation)
                    {
                        new 
id pev(indexpev_owner);
                        if( 
id )
                        {
                            
set_pev(idpev_weaponanimM4A1_ATTACHSILENCEANIM);
                        }
                    }
                }
            }
            else if(
silencemode M4A1_SILENCED)
            {
                
silencemode &= ~M4A1_SILENCED;
                
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,silencemode,EXTRAOFFSET_WEAPONS);

                if (
draw_animation)
                {
                    new 
id pev(indexpev_owner);
                    if( 
id )
                    {
                        
set_pev(idpev_weaponanimM4A1_DETACHSILENCEANIM);
                    }
                }
            }
        }
        case 
CSW_USP:
        {
            new 
silencemode get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS);
            if (
silence)
            {
                if (!(
silencemode USP_SILENCED))
                {
                    
silencemode |= USP_SILENCED;
                    
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,silencemode,EXTRAOFFSET_WEAPONS);

                    if (
draw_animation)
                    {
                        new 
id pev(indexpev_owner);
                        if( 
id )
                        {
                            
set_pev(idpev_weaponanimUSP_ATTACHSILENCEANIM);
                        }
                    }
                }
            }
            else if (
silencemode USP_SILENCED)
            {
                
silencemode &= ~USP_SILENCED;
                
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,silencemode,EXTRAOFFSET_WEAPONS);

                if (
draw_animation)
                {
                    new 
id pev(indexpev_owner);
                    if( 
id )
                    {
                        
set_pev(idpev_weaponanimUSP_DETACHSILENCEANIM);
                    }
                }
            }
        }
        default:return 
0;
    }

    return 
1;
}

stock cs_set_weapon_burst(indexburstmode 1)
{
    switch (
cs_get_weapon_id(index))
    {
        case 
CSW_GLOCK18:
        {
            if (
burstmode)
            {
                if (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) != GLOCK_BURSTMODE)
                {
                    
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,GLOCK_BURSTMODE,EXTRAOFFSET_WEAPONS);

                    new 
id pev(indexpev_owner);
                    if( 
id )
                    {
                        
client_print(idprint_center"#Switch_To_BurstFire");
                    }
                }
            }
            else if (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) != GLOCK_SEMIAUTOMATIC)
            {
                
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,GLOCK_SEMIAUTOMATIC,EXTRAOFFSET_WEAPONS);

                new 
id pev(indexpev_owner);
                if( 
id )
                {
                    
client_print(idprint_center"#Switch_To_SemiAuto");
                }
            }
        }
        case 
CSW_FAMAS:
        {
            if (
burstmode)
            {
                if (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) != FAMAS_BURSTMODE)
                {
                    
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,FAMAS_BURSTMODE,EXTRAOFFSET_WEAPONS);

                    new 
id pev(indexpev_owner);
                    if( 
id )
                    {
                        
client_print(idprint_center"#Switch_To_BurstFire");
                    }
                }
            }
            else if (
get_pdata_int(index,OFFSET_SILENCER_FIREMODE,EXTRAOFFSET_WEAPONS) != FAMAS_AUTOMATIC)
            {
                
set_pdata_int(index,OFFSET_SILENCER_FIREMODE,FAMAS_AUTOMATIC,EXTRAOFFSET_WEAPONS);

                new 
id pev(indexpev_owner);
                if( 
id )
                {
                    
client_print(idprint_center"#Switch_To_FullAuto");
                }
            }
        }
        default:
        {
            return 
0;
        }
    }

    return 
1;

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
 



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:58.


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