Raised This Month: $ Target: $400
 0% 

Silence USP and M4A1 at spawn/purchase


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 06-06-2018 , 09:35   Silence USP and M4A1 at spawn/purchase
Reply With Quote #1

I need a script that will silence the usp if you buy it or you spawn with it as a CT. Also, I need it to silence M4A1 on purchase too. It should allow removing the silencer.
sekac is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-06-2018 , 10:45   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #2

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

public plugin_init()
{
	register_plugin("Silencer","0.0.1","SmileY");
	
	RegisterHamPlayer(Ham_AddPlayerItem,"HamAddPlayerItem",true);
}

public HamAddPlayerItem(id,Ent)
{
	new Weapon = cs_get_weapon_id(Ent);
	
	if(Weapon == CSW_M4A1 || Weapon == CSW_USP)
	{
		cs_set_weapon_silen(Ent,1,0);
	}
}
Not tested
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
sekac
Senior Member
Join Date: Nov 2016
Old 06-06-2018 , 11:05   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #3

Thank you! Any way to make the silencer appear instantly?
sekac is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-06-2018 , 11:23   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #4

Quote:
Originally Posted by sekac View Post
Thank you! Any way to make the silencer appear instantly?
works? anyway it already do it, but without delay to fire the weapon
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
sekac
Senior Member
Join Date: Nov 2016
Old 06-06-2018 , 11:38   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #5

Quote:
Originally Posted by ^SmileY View Post
works? anyway it already do it, but without delay to fire the weapon
Yeah it works, but it takes some time for the silencer to show up.
sekac is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-06-2018 , 12:26   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #6

Quote:
Originally Posted by sekac View Post
Yeah it works, but it takes some time for the silencer to show up.
change 0 to 1, since silencer appearance only update on item deploy or shot, then will animate silencer use without delay of shot, but if you need to use shot delay after silence usage, put 0 to 2
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
sekac
Senior Member
Join Date: Nov 2016
Old 06-06-2018 , 12:37   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #7

Quote:
Originally Posted by ^SmileY View Post
change 0 to 1, since silencer appearance only update on item deploy or shot, then will animate silencer use without delay of shot, but if you need to use shot delay after silence usage, put 0 to 2
I'll use 0. BTW 1 and 2 crash my game.
sekac is offline
sekac
Senior Member
Join Date: Nov 2016
Old 06-08-2018 , 14:35   Re: Silence USP and M4A1 at spawn/purchase
Reply With Quote #8

Actually this silences them even if you pickup an unsilenced gun. I want it only on spawn/buy.
sekac is offline
Reply


Thread Tools
Display Modes

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 04:36.


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