AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound Replace (https://forums.alliedmods.net/showthread.php?t=325276)

NooTy 06-15-2020 08:08

Sound Replace
 
Hey, I wanna help in this code
Code:

public fw_EmitSound(id, channel, String:sample[], Float:volume, Float:attn, flags, pitch)
{
    if (!is_user_connected(id))
    {
        return 1;
    }
        if (scmode[id] && equal(sample[8], "mp5",3))
    {
        if (equal(sample[14], "sho",3))
        volume = 0.60/*1058642330*/;
        {
        if (equal(sample, "weapons/mp5-1.wav"))
        {
            emit_sound(id, CHAN_ITEM, "Brawl_Stars/effects/colt_attack.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        if (equal(sample, "weapons/mp5-2.wav"))
        {
            emit_sound(id, CHAN_ITEM, "Brawl_Stars/effects/colt_attack.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
}
        }

        if (skmode[id] && equal(sample[8], "kni",3))
    {
        volume = 0.60/*1058642330*/;
        if (equal(sample[14], "sla",3))
        {
            engfunc(EngFunc_EmitSound, id, channel, "Brawl_Stars/effects/mortis_attack.wav", volume, attn, flags, pitch);
            return 4;
        }
}
    return FMRES_IGNORED;
}

when i slap with knife work but mp5 not work

Celena Luna 06-15-2020 10:04

Re: Sound Replace
 
Quote:

Originally Posted by Arkshine (Post 1471921)
Weapon sounds, except for knife, can't be hooked since they are played client-side.

I don't think inserting the fire sound into the weapon will block the sound played on the client.

To have your own sounds, you have to redo the whole weapon as amxx plugin, which is not that hard.

You can't replace but override it. Hook PrimaryAttack Post then try emit the shooting sound there
Other way could be block the shooting effect (but it also block shoot anim, bullet hole, bullet smoke, crosshair recoil changing,...) and emit it there but if you only need to change shooting sound, it is at bit too much

NooTy 06-16-2020 02:50

Re: Sound Replace
 
Quote:

Originally Posted by Celena Luna (Post 2705825)
You can't replace but override it. Hook PrimaryAttack Post then try emit the shooting sound there
Other way could be block the shooting effect (but it also block shoot anim, bullet hole, bullet smoke, crosshair recoil changing,...) and emit it there but if you only need to change shooting sound, it is at bit too much

thx moon


All times are GMT -4. The time now is 16:59.

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