AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Replacing knife sounds (https://forums.alliedmods.net/showthread.php?t=160120)

bibu 06-25-2011 09:22

Replacing knife sounds
 
This plugin here, doesn't change some sounds, or use them randomly from the custom sounds. I don't know if it has todo cause the names are not equal. I wanted that *_hit, should replace all the hits sounds and *slash_stab the slash1, slash2, stab sounds:

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "."

new const knife_sounds_original[][] =
{
    
"weapons/knife_deploy1.wav",
    
"weapons/knife_hit1.wav",
    
"weapons/knife_hit2.wav",
    
"weapons/knife_hit3.wav",
    
"weapons/knife_hit4.wav",
    
"weapons/knife_hitwall1.wav",
    
"weapons/knife_slash1.wav",
    
"weapons/knife_slash2.wav",
    
"weapons/knife_stab.wav"
}

new const 
knife_sounds_custom[][] =
{
    
"weapons/tazer/tazer_deploy1.wav",
    
"weapons/tazer/tazer_hit.wav",
    
"weapons/tazer/tazer_hitwall1.wav",
    
"weapons/tazer/tazer_slash_stab.wav"
}


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_EmitSound"EmitSound")
}

public 
plugin_precache()
{
    for(new 
0sizeof knife_sounds_customi++)
    {
        
precache_sound(knife_sounds_custom[i])
    }
}

public 
EmitSound(entitychannel, const sound[])
{
    if(
pev_valid(entity) && is_user_alive(entity) && get_user_team(entity) == 2)
    {
        for(new 
0sizeof knife_sounds_customi++)
        {
            if(
equal(soundknife_sounds_original[i]))
            {
                
emit_sound(entitychannelknife_sounds_custom[i], 1.0ATTN_NORM0PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
        }
    }
    return 
FMRES_IGNORED



nikhilgupta345 06-25-2011 12:29

Re: Replacing knife sounds
 
PHP Code:


new const knife_sounds_custom[][] =
{
    
"weapons/tazer/tazer_deploy1.wav",
    
"weapons/tazer/tazer_hit.wav",
    
"weapons/tazer/tazer_hitwall1.wav",
    
"weapons/tazer/tazer_slash_stab.wav"


->

PHP Code:


new const knife_sounds_custom[][] =
{
    
"weapons/tazer/tazer_deploy1.wav",
    
"weapons/tazer/tazer_hit.wav",
    
"weapons/tazer/tazer_hit.wav",
    
"weapons/tazer/tazer_hit.wav",
    
"weapons/tazer/tazer_hit.wav",
    
"weapons/tazer/tazer_hitwall1.wav",
    
"weapons/tazer/tazer_slash_stab.wav",
    
"weapons/tazer/tazer_slash_stab.wav",
    
"weapons/tazer/tazer_slash_stab.wav



bibu 06-25-2011 12:30

Re: Replacing knife sounds
 
Yes, just figured it out, thanks. :)


All times are GMT -4. The time now is 23:24.

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