AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Silence USP and M4A1 at spawn/purchase (https://forums.alliedmods.net/showthread.php?t=308091)

sekac 06-06-2018 09:35

Silence USP and M4A1 at spawn/purchase
 
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.

^SmileY 06-06-2018 10:45

Re: Silence USP and M4A1 at spawn/purchase
 
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

sekac 06-06-2018 11:05

Re: Silence USP and M4A1 at spawn/purchase
 
Thank you! Any way to make the silencer appear instantly?

^SmileY 06-06-2018 11:23

Re: Silence USP and M4A1 at spawn/purchase
 
Quote:

Originally Posted by sekac (Post 2595579)
Thank you! Any way to make the silencer appear instantly?

works? anyway it already do it, but without delay to fire the weapon

sekac 06-06-2018 11:38

Re: Silence USP and M4A1 at spawn/purchase
 
Quote:

Originally Posted by ^SmileY (Post 2595582)
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.

^SmileY 06-06-2018 12:26

Re: Silence USP and M4A1 at spawn/purchase
 
Quote:

Originally Posted by sekac (Post 2595585)
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

sekac 06-06-2018 12:37

Re: Silence USP and M4A1 at spawn/purchase
 
Quote:

Originally Posted by ^SmileY (Post 2595591)
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 06-08-2018 14:35

Re: Silence USP and M4A1 at spawn/purchase
 
Actually this silences them even if you pickup an unsilenced gun. I want it only on spawn/buy.


All times are GMT -4. The time now is 04:36.

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