FULL CODE:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <orpheu>
#include <orpheu_stocks>
new const VERSION[] = "1.0"
new const footsteps_sound_snow[][] =
{
"player/pl_snow1.wav",
"player/pl_snow2.wav",
"player/pl_snow3.wav",
"player/pl_snow4.wav",
"player/pl_snow5.wav",
"player/pl_snow6.wav"
}
new bool:IsUserAlive[33]
new OrpheuHook:PM_PlaySoundHook
new OrpheuStruct:g_ppmove
public plugin_init()
{
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnKilled", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerSpawnKilled", 1)
OrpheuRegisterHook(OrpheuGetDLLFunction("pfnPM_Move", "PM_Move"), "OnPM_Move")
new OrpheuFunction:PM_PlayStepSound = OrpheuGetFunction("PM_PlayStepSound")
OrpheuRegisterHook(PM_PlayStepSound, "OnPM_PlayStepSound")
OrpheuRegisterHook(PM_PlayStepSound, "OnPM_PlayStepSoundPost", OrpheuHookPost)
}
public plugin_precache()
{
register_plugin("Snow", VERSION, "eXcalibur.007")
engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))
server_cmd("sv_skyname snow")
for(new i = 0 ; i < sizeof footsteps_sound_snow; i++)
precache_sound(footsteps_sound_snow[i])
}
public client_putinserver(id)
{
client_cmd(id, "cl_weather 1")
}
public client_disconnect(id)
{
IsUserAlive[id] = false
}
public fw_PlayerSpawnKilled(id)
{
IsUserAlive[id] = bool:is_user_alive(id)
}
public OnPM_Move(OrpheuStruct:ppmove, server)
{
g_ppmove = ppmove
}
public OnPM_PlayStepSound(step, Float:vol)
{
new PM_PlaySoundAddress = OrpheuGetParamStructMember(1, "PM_PlaySound")
new OrpheuFunction:PM_PlaySound = OrpheuCreateFunction(PM_PlaySoundAddress, "PM_PlaySound")
PM_PlaySoundHook = OrpheuRegisterHook(PM_PlaySound, "OnPM_PlaySoundHook")
}
public OnPM_PlaySoundHook(channel, sample[], Float:volume, Float:attenuation, flags, pitch)
{
new id = OrpheuGetStructMember(g_ppmove, "player_index") + 1
if(is_user_outside(id))
{
OrpheuSetParam(2, footsteps_sound_snow[random(sizeof footsteps_sound_snow)])
}
}
public OnPM_PlayStepSoundPost(step, Float:vol)
{
OrpheuUnregisterHook(PM_PlaySoundHook)
}
stock Float:is_user_outside(id)
{
new Float:origin[3], Float:fDist
pev(id, pev_origin, origin)
fDist = origin[2]
while(engfunc(EngFunc_PointContents, origin) == CONTENTS_EMPTY)
{
origin[2] += 5.0
}
if(engfunc(EngFunc_PointContents, origin) == CONTENTS_SKY)
{
return(origin[2] - fDist)
}
return 0.0
}
Not original sounds the snow footsteps sound doesn't play.
EDIT: After some searching in the forums, I see a probability of disappointment

. Some posts has replies that sounds cannot be blocked(Footsteps).
If this is true, please close this thread.