#include <amxmodx>
#include <orpheu_stocks>
#include <hlsdk_const>
#define PLUGIN "Jump Sound Blocker"
#define VERSION "1.0.2"
#define AUTHOR "hornet"
enum
{
STEP_CONCRETE,
STEP_METAL,
STEP_DIRT,
STEP_VENT,
STEP_GRATE,
STEP_TILE,
STEP_SLOSH,
STEP_WADE,
STEP_LADDER,
STEP_SNOW,
STEP_GRASS
}
new OrpheuStruct:g_ppmove;
new g_iBlockStep[ 33 ];
new g_pBlockTeam;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
OrpheuRegisterHook( OrpheuGetDLLFunction( "pfnPM_Move", "PM_Move" ), "OnPM_Move" );
OrpheuRegisterHook( OrpheuGetFunction( "PM_PlayStepSound" ), "OnPM_PlayStepSound" );
g_pBlockTeam = register_cvar( "jsb_team", "0" );
server_cmd( "mp_footsteps 0" );
}
public OrpheuHookReturn:OnPM_Move( OrpheuStruct:ppmove, server )
{
g_ppmove = ppmove;
new iTeam = get_pcvar_num( g_pBlockTeam );
new iPlayer = OrpheuGetStructMember( ppmove, "player_index" ) + 1;
if( !iTeam || get_user_team( iPlayer ) == iTeam )
{
if( ( OrpheuGetStructMember( OrpheuStruct:OrpheuGetStructMember( ppmove, "cmd" ), "buttons" ) & IN_JUMP )
&&( !( OrpheuGetStructMember( ppmove, "oldbuttons" ) & IN_JUMP ) )
&&( OrpheuGetStructMember( ppmove, "onground" ) != -1 ) )
g_iBlockStep[ iPlayer ] = 1;
}
}
public OrpheuHookReturn:OnPM_PlayStepSound( iStep, Float:flVol )
{
new iPlayer = OrpheuGetStructMember( g_ppmove, "player_index" ) + 1;
switch( g_iBlockStep[ iPlayer ] )
{
case 1:
{
g_iBlockStep[ iPlayer ] = 2;
return OrpheuSupercede;
}
case 2:
{
g_iBlockStep[ iPlayer ] = 0;
return OrpheuSupercede;
}
}
new iRand = random_num( 0, 3 );
switch ( iStep )
{
case STEP_METAL:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_metal1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_metal3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_metal2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_metal4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_DIRT:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_dirt1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_dirt3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_dirt2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_dirt4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_VENT:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_duct1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_duct3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_duct2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_duct4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_GRATE:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_grate1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_grate3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_grate2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_grate4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_TILE:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_tile1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_tile3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_tile2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_tile4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_SLOSH:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_slosh1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_slosh3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_slosh2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_slosh4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_WADE:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_wade1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_wade2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_wade3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_wade4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_LADDER:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_ladder1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_ladder3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_ladder2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_ladder4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_SNOW:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_snow1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_snow3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_snow2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_snow4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
case STEP_GRASS:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_grass1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_grass3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_grass2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_grass4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
default:
{
switch( iRand )
{
case 0: emit_sound( iPlayer, CHAN_BODY, "player/pl_step1.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 1: emit_sound( iPlayer, CHAN_BODY, "player/pl_step3.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 2: emit_sound( iPlayer, CHAN_BODY, "player/pl_step2.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
case 3: emit_sound( iPlayer, CHAN_BODY, "player/pl_step4.wav", flVol, ATTN_NORM, 0, PITCH_NORM );
}
}
}
return OrpheuIgnored;
}