Raised This Month: $ Target: $400
 0% 

Footsteps doesn't play.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 11-29-2010 , 06:27   Footsteps doesn't play.
Reply With Quote #1

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_CreateNamedEntityengfunc(EngFunc_AllocString"env_snow"))
    
    
server_cmd("sv_skyname snow")
    
    for(new 
sizeof footsteps_sound_snowi++)
        
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:ppmoveserver)
{
    
g_ppmove ppmove
}

public 
OnPM_PlayStepSound(stepFloat: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(channelsample[], Float:volumeFloat:attenuationflagspitch)
{
    new 
id OrpheuGetStructMember(g_ppmove"player_index") + 1
    
    
if(is_user_outside(id))
    {
        
OrpheuSetParam(2footsteps_sound_snow[random(sizeof footsteps_sound_snow)])
    }
}

public 
OnPM_PlayStepSoundPost(stepFloat:vol)
{
    
OrpheuUnregisterHook(PM_PlaySoundHook)
}

stock Float:is_user_outside(id)
{
    new 
Float:origin[3], Float:fDist
    pev
(idpev_originorigin)
    
    
fDist origin[2]
    
    while(
engfunc(EngFunc_PointContentsorigin) == CONTENTS_EMPTY)
    {
        
origin[2] += 5.0
    
}
    
    if(
engfunc(EngFunc_PointContentsorigin) == 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.

Last edited by Excalibur.007; 12-02-2010 at 06:19.
Excalibur.007 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-29-2010 , 11:06   Re: Footsteps doesn't play.
Reply With Quote #2

Try passing 400.0 in the first block of code instead of 400.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 11-29-2010 , 12:11   Re: Footsteps doesn't play.
Reply With Quote #3

Oh long time not see Hawk552 !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 11-29-2010 , 13:10   Re: Footsteps doesn't play.
Reply With Quote #4

Quote:
Originally Posted by K.K.Lv View Post
Oh long time not see Hawk552 !
Oh stop spamming and at least say something to help excalibur's problem.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-29-2010 , 13:19   Re: Footsteps doesn't play.
Reply With Quote #5

Search for joaquimandrade post on how to hook PM_PlaySound, hook it and do what you need to do.
Or hook PM_PlayStepSound if it better fits your needs.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 11-29-2010 , 18:16   Re: Footsteps doesn't play.
Reply With Quote #6

I'll try everything useful in here. Then i'll edit this post

EDIT:
@ Hawk
Tried it, didn't work.

@Connor
Umm? How do we do that? I'm new to orpheu

Last edited by Excalibur.007; 11-29-2010 at 18:52.
Excalibur.007 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-29-2010 , 21:58   Re: Footsteps doesn't play.
Reply With Quote #7

Quote:
Originally Posted by Excalibur.007 View Post
@Connor
Umm? How do we do that? I'm new to orpheu
Something like this (most of the code taken from joaquim's Orpheu thread's first post):
Code:
#include <amxmodx> #include <fakemeta> #include <orpheu> #include <orpheu_stocks> 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 OrpheuHook:PM_PlaySoundHook new OrpheuStruct:g_ppmove public plugin_init() {     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 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 }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 11-30-2010 at 22:07.
Exolent[jNr] is offline
Reply



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 11:18.


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