PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#define VERSION "0.1"
new SoundsHere[ 3 ][ ] =
{
"sound/soundhere1.wav", "sound/soundhere2.wav", "sound/soundhere3.wav"
}
public plugin_init( )
{
register_plugin( "Footsteps Example", VERSION, "3Di" );
register_forward( FM_PlayerPreThink, "PlayerThink", 1 );
}
public plugin_precache( )
{
precache_sound( "sound/soundhere1.wav" );
precache_sound( "sound/soundhere2.wav" );
precache_sound( "sound/soundhere3.wav" );
}
public PlayerThink( id )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED;
new CsTeams:CheckTeam = cs_get_user_team( id );
new ButtonId = get_user_button( id );
if( ( ButtonId & IN_FORWARD ) || ( ButtonId & IN_BACK ) || ( ButtonId & IN_MOVELEFT ) || ( ButtonId & IN_MOVERIGHT ) )
{
switch( CheckTeam )
{
case CS_TEAM_T:
{
emit_sound( id, CHAN_ITEM, SoundsHere[ random_num( 0, 3 ) ], 1.0, ATTN_NORM, 0, PITCH_HIGH );
}
}
}
return PLUGIN_CONTINUE;
}