Raised This Month: $ Target: $400
 0% 

Auto silencer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kp3t3h
Senior Member
Join Date: Feb 2011
Old 10-24-2012 , 06:47   Auto silencer
Reply With Quote #1

i need a plugin which will make all weapons with silencer (m4a1 & usp) to be automatically silenced.
so when player picks up the weapon the silencer is already on, and also he cannot remove it (no animation of removing it either)
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5
kp3t3h is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 10-24-2012 , 14:52   Re: Auto silencer
Reply With Quote #2

Try this:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Only Silencer"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Item_Deploy"weapon_usp""Weapon_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_m4a1""Weapon_Deploy"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_usp""Weapon_Silencer_Fix"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m4a1""Weapon_Silencer_Fix"1)
}

public 
Weapon_Deploy(iEnt)
{
    
cs_set_weapon_silen(iEnt10)
    
ExecuteHam(Ham_Item_DeployiEnt)
    
set_pdata_float(iEnt479999.0)
}

public 
Weapon_Silencer_Fix(iEnt)
{
    
set_pdata_float(iEnt479999.0)

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
kp3t3h
Senior Member
Join Date: Feb 2011
Old 10-24-2012 , 16:25   Re: Auto silencer
Reply With Quote #3

doesn't work
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5
kp3t3h is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 10-24-2012 , 16:38   Re: Auto silencer
Reply With Quote #4

Works fine, I tested it.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
kp3t3h
Senior Member
Join Date: Feb 2011
Old 10-24-2012 , 17:18   Re: Auto silencer
Reply With Quote #5

i dont know, but it crashes the server, once equipped usp (dont know for m4a1) server is down
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5
kp3t3h is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-24-2012 , 17:31   Re: Auto silencer
Reply With Quote #6

You probably have some other plugin that makes this one crash...
__________________
Jhob94 is offline
kp3t3h
Senior Member
Join Date: Feb 2011
Old 10-24-2012 , 17:57   Re: Auto silencer
Reply With Quote #7

its not another plugin causing the problem, i started only this one and still it crashes, sometimes doesn't even start
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5
kp3t3h is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-24-2012 , 18:11   Re: Auto silencer
Reply With Quote #8

Try if this is working :

PHP Code:
#include <amxmodx>

#include <hamsandwich>

#tryinclude <cstrike_pdatas>

#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif

#define PLUGIN ""
#define VERSION "0.0.1"

enum ( <<=)
{
    
WEAPONSTATE_USP_SILENCED 1,
    
WEAPONSTATE_GLOCK18_BURST_MODE,
    
WEAPONSTATE_M4A1_SILENCED,
    
WEAPONSTATE_ELITE_LEFT,
    
WEAPONSTATE_FAMAS_BURST_MODE,
    
WEAPONSTATE_SHIELD_DRAWN
}

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )
    
RegisterHam(Ham_Item_Deploy"weapon_usp""OnCUSP_Deploy"false)
    
RegisterHam(Ham_Item_Deploy"weapon_m4a1""OnCM4A1_Deploy"false)
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_usp""OnCUSP_SecondaryAttack"false)
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_m4a1""OnCM4A1_SecondaryAttack"false)
}

public 
OnCUSP_Deployusp )
{
    
// new id = get_pdata_cbase(usp, m_pPlayer, XO_CBASEPLAYERITEM)
    // if( !get_pdata_bool(id, m_bHasShield) )
    // {
        // new fWeaponState = get_pdata_int(usp, m_fWeaponState, XO_CBASEPLAYERWEAPON)
        // if( ~fWeaponState & WEAPONSTATE_USP_SILENCED )
        // {
            // set_pdata_int(usp, m_fWeaponState, fWeaponState | WEAPONSTATE_USP_SILENCED, XO_CBASEPLAYERWEAPON)
        // }
    // }

    
new fWeaponState get_pdata_int(uspm_fWeaponStateXO_CBASEPLAYERWEAPON)
    if( ~
fWeaponState WEAPONSTATE_USP_SILENCED )
    {
        
set_pdata_int(uspm_fWeaponStatefWeaponState WEAPONSTATE_USP_SILENCEDXO_CBASEPLAYERWEAPON)
    }
    
set_pdata_float(uspm_flNextSecondaryAttack9999.9XO_CBASEPLAYERWEAPON)
}

public 
OnCM4A1_Deploym4a1 )
{
    new 
fWeaponState get_pdata_int(m4a1m_fWeaponStateXO_CBASEPLAYERWEAPON)
    if( ~
fWeaponState WEAPONSTATE_M4A1_SILENCED )
    {
        
set_pdata_int(m4a1m_fWeaponStatefWeaponState WEAPONSTATE_M4A1_SILENCEDXO_CBASEPLAYERWEAPON)
    }
    
set_pdata_float(m4a1m_flNextSecondaryAttack9999.9XO_CBASEPLAYERWEAPON)
}

public 
OnCUSP_SecondaryAttackusp )
{
    
set_pdata_float(uspm_flNextSecondaryAttack9999.9XO_CBASEPLAYERWEAPON)
    return 
HAM_SUPERCEDE
}

public 
OnCM4A1_SecondaryAttackm4a1 )
{
    
set_pdata_float(m4a1m_flNextSecondaryAttack9999.9XO_CBASEPLAYERWEAPON)
    return 
HAM_SUPERCEDE

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 10-24-2012 , 18:18   Re: Auto silencer
Reply With Quote #9

Bibus way is working, i tried it too..
Torge is offline
kp3t3h
Senior Member
Join Date: Feb 2011
Old 10-24-2012 , 18:52   Re: Auto silencer
Reply With Quote #10

thankyou connor



though there is a little problem, if i right click ("attack2") just after i fired from the silenced weapon, i dont know how to say this, but, the gun stops moving. And if i do that if i fire and right click, it does the animation (and sound) as if i have changed to it again.
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5

Last edited by kp3t3h; 10-24-2012 at 18:52.
kp3t3h 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 19:36.


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