|
Member
|
07-21-2022
, 06:56
Re: Change default steps
|
#5
|
I make this plugin, but he removes all walking sounds. What should I do to add the sounds of walking up a ladder, swimming?
Quote:
register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink", 0);
new const g_szStepSound[MAX_SOUNDS][] = {
"player/jb/pl_step1.wav",
"player/jb/pl_step2.wav",
"player/jb/pl_step3.wav",
"player/jb/pl_step4.wav"
};
public fwd_PlayerPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
set_pev(id, pev_flTimeStepSound, 99999);
if(g_fNextStep[id] < get_gametime())
{
if(fm_get_ent_speed(id) && (pev(id, pev_flags) & FL_ONGROUND))
emit_sound(id, CHAN_BODY, g_szStepSound[random(MAX_SOUNDS)], VOL_NORM, ATTN_STATIC, 0, PITCH_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(id, pev_velocity, vVelocity);
vVelocity[2] = 0.0;
return vector_length(vVelocity);
}
|
|
|
|
|