Raised This Month: $ Target: $400
 0% 

Change footsteps sound, possible?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-28-2010 , 17:13   Re: Change footsteps sound, possible?
Reply With Quote #9

Yest, they are played random...you can modify the array to 2D size, then put more custom sounds, and into emit_sound native, make it play a random step sound.

PHP Code:
#include <amxmodx>
#include <fakemeta>

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

#define STEP_DELAY 0.5

new Float:g_fNextStep[33];

#define MAX_SOUNDS 4 //Max num of sound for list below

new const g_szStepSound[MAX_SOUNDS][] = {
    
    
"custom_step_sound#1.wav",
    
"custom_step_sound#2.wav",
    
"custom_step_sound#3.wav",
    
"custom_step_sound#4.wav"
};

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink"0);
}

public 
plugin_precache()
{
    new 
i;
    for(
0MAX_SOUNDS i++)
        
precache_sound(g_szStepSound[i]);
}

public 
fwd_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    
set_pev(idpev_flTimeStepSound999);
    
    if(
g_fNextStep[id] < get_gametime())
    {
        if(
fm_get_ent_speed(id) && (pev(idpev_flags) & FL_ONGROUND))
            
emit_sound(idCHAN_BODYg_szStepSound[random(MAX_SOUNDS)], VOL_NORMATTN_STATIC0PITCH_NORM);
        
        
g_fNextStep[id] = get_gametime() + STEP_DELAY;
    }
    return 
FMRES_IGNORED;
}

stock Float:fm_get_ent_speed(id)
{
    if(!
pev_valid(id))
        return 
0.0;
    
    static 
Float:vVelocity[3];
    
pev(idpev_velocityvVelocity);
    
    
vVelocity[2] = 0.0;
    
    return 
vector_length(vVelocity);

__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 05-28-2010 at 18:31. Reason: Updated
Alka is offline
 



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 03:08.


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