AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [Tutorial] [CS:GO] How to make a gun silent (https://forums.alliedmods.net/showthread.php?t=329079)

eyal282 12-07-2020 10:50

[Tutorial] [CS:GO] How to make a gun silent
 
Code:

AddTempEntHook("Shotgun Shot", Hook_FireBullets);


public Action:Hook_FireBullets(const String:te_name[], const Players[], numClients, Float:delay)
{
        new client = 0;
       
        for (new i = 1; i <= MaxClients;i++)
        {
                if(!IsClientInGame(i))
                        continue;
                       
                new bool:Found = false;
               
                for (new a = 0; a < numClients;a++)
                {
                        if(Players[a] == i)
                                Found = true;
                }
               
                if(!Found)
                {
                        client = i;
                       
                        break;
                }
        }
       
        if(client == 0)
                return Plugin_Continue;
       
        new weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");

        if(weapon == -1)
                return Plugin_Continue;

        // client is the player that fired the weapon       
        // weapon is the weapon that was fired.
        return Plugin_Stop;
}

I have no clue why the temp ent is "Shotgun Shot" but it actually works.

zipcore 12-08-2020 10:31

Re: [Tutorial] [CS:GO] How to make a gun silent
 
Quote:

Originally Posted by eyal282 (Post 2727925)
I have no clue why the temp ent is "Shotgun Shot" but it actually works.


Thats how it worked for shotguns only some time ago. They moved all weapons fire sounds to this method and havn't renamed it.

eyal282 12-13-2020 07:17

Re: [Tutorial] [CS:GO] How to make a gun silent
 
Quote:

Originally Posted by zipcore (Post 2728056)
Thats how it worked for shotguns only some time ago. They moved all weapons fire sounds to this method and havn't renamed it.

Very practical, sure I can live with that.


All times are GMT -4. The time now is 15:27.

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