AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Jump sound (https://forums.alliedmods.net/showthread.php?t=117530)

benamo6 02-02-2010 01:16

Jump sound
 
How can I block jump sound? Im using
PHP Code:

set_user_footsteps(id1

to block user step sounds but I can still hear jump sound.

BannedUser! 02-02-2010 03:57

Re: Jump sound
 
Quote:

Originally Posted by benamo6 (Post 1075829)
How can I block jump sound? Im using
PHP Code:

set_user_footsteps(id1

to block user step sounds but I can still hear jump sound.

In prethink
set_pev(id, pev_flTimeStepSound, STEPTIME_SILENT)

(NEEDED FAKEMETA)

ConnorMcLeod 02-02-2010 12:52

Re: Jump sound
 
Fakemeta is the same, stay with fun.
You should use orpheu in order to block jump sounds.

benamo6 02-02-2010 13:20

Re: Jump sound
 
I never used orpheu before, Ive been reading but I cant get it could you give me a hand?

ConnorMcLeod 02-02-2010 13:31

Re: Jump sound
 
No sorry, i have no idea how to use that module.

Arkshine 02-02-2010 15:51

Re: Jump sound
 
Quote:

Originally Posted by benamo6 (Post 1075829)
How can I block jump sound? Im using
PHP Code:

set_user_footsteps(id1

to block user step sounds but I can still hear jump sound.

Probably done client-side. You can't block it with a server-side module/plugin.

All the PM_* we can hook, like PM_PlayStepSound() which plays the player's step sound, we can't block it because the same code is running on the client and because of the client prediction we can't block the function. The native set flTimeStepSound to a hight value (999) in a prethink function so PM_UpdateStepSound() will abort because there is a check "flTimeStepSound > 0 return". Now, the problem is PM_PlayStepSound() is called directly in PM_Jump() ( so when do a jump ). I will try a trick.

lazarev 12-16-2010 12:32

Re: Jump sound
 
Quote:

Originally Posted by Arkshine (Post 1076366)
Probably done client-side. You can't block it with a server-side module/plugin.

All the PM_* we can hook, like PM_PlayStepSound() which plays the player's step sound, we can't block it because the same code is running on the client and because of the client prediction we can't block the function. The native set flTimeStepSound to a hight value (999) in a prethink function so PM_UpdateStepSound() will abort because there is a check "flTimeStepSound > 0 return". Now, the problem is PM_PlayStepSound() is called directly in PM_Jump() ( so when do a jump ). I will try a trick.

B.U.M.P. :grrr:

nikhilgupta345 07-01-2011 00:15

Re: Jump sound
 
bump :)

lazarev 07-01-2011 07:37

Re: Jump sound
 
PHP Code:

#include < amxmodx >
#include < hlsdk_const >
#include < orpheu_stocks >

#define STEP_CONCRETE   0
#define STEP_METAL      1
#define STEP_DIRT    2
#define STEP_VENT    3       
#define STEP_GRATE      4       
#define STEP_TILE    5
#define STEP_SLOSH      6
#define STEP_WADE    7       
#define STEP_LADDER     8      
#define STEP_SNOW    9  
#define STEP_GRASS      10    

new const VERSION[] = "0.0.1";

new 
OrpheuStruct:pmove;
static 
iPlayer;
static 
g_iTeam33 ], bool:g_bPlayJumpStep33 ];

new 
footsteps_team;
new 
footsteps_jump_team;

public 
plugin_init() 
{
    
register_plugin"[ORPHEU] Footsteps"VERSION"Juice" );
    
    
footsteps_team register_cvar"footsteps_team""0" );
    
footsteps_jump_team register_cvar"footsteps_jump_team""1" );
    
    
register_messageget_user_msgid"TeamInfo" ), "msg_TeamInfo" );
    
    
OrpheuRegisterHookOrpheuGetDLLFunction"pfnPM_Move","PM_Move" ), "OnPM_Move" );
    
OrpheuRegisterHookOrpheuGetFunction"PM_PlayStepSound" ), "onPM_PlayStepSound" );
    
    if( 
get_pcvar_numfootsteps_team ) || get_pcvar_numfootsteps_jump_team ) )
    {
        
server_cmd"mp_footsteps 0" );
    }
}

public 
OrpheuHookReturn:OnPM_MoveOrpheuStruct:ppmoveserver )
{
    
pmove ppmove;
    
iPlayer OrpheuGetStructMemberppmove"player_index" ) + 1;
    
    
g_bPlayJumpStepiPlayer ] = 
    (    
OrpheuGetStructMember(OrpheuStruct:OrpheuGetStructMember(ppmove"cmd"), "buttons" ) & IN_JUMP)
    &&     
OrpheuGetStructMember(ppmove"onground") != -1
    
&&     ~(OrpheuGetStructMember(ppmove"oldbuttons") & IN_JUMP
    &&     ( 
        
get_pcvar_numfootsteps_jump_team ) == 
    
||     get_pcvar_numfootsteps_jump_team ) < && g_iTeamiPlayer ] == get_pcvar_numfootsteps_jump_team 
        )
    ? 
true false;
    
    return 
OrpheuIgnored;
}

// http://forums.alliedmods.net/showthread.php?t=123097/
// http://cs-sdk.googlecode.com/svn/trunk/pm_shared.c/
public OrpheuHookReturn:onPM_PlayStepSoundstepFloat:fvol )
{
    if( !
g_bPlayJumpStepiPlayer ] )
    {
        if
        ( !
get_pcvar_numfootsteps_team )
        ||
get_pcvar_numfootsteps_team ) < && get_pcvar_numfootsteps_team ) != g_iTeamiPlayer 
        )
        return 
OrpheuIgnored;
    }
    static 
iSkipStepirand;
    
irand random_num(0,1) + (OrpheuGetStructMemberpmove"iStepLeft" ) * 2);
    
    switch ( 
step )
    {
        case 
STEP_METAL:
        {
            switch(
irand)
            {
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_metal1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_metal3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_metal2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_metal4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        case 
STEP_DIRT:
        {
            switch(
irand)
            {
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_dirt1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_dirt3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_dirt2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_dirt4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        
        case 
STEP_VENT:
        {
            switch(
irand)
            {
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_duct1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_duct3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_duct2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_duct4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        
        case 
STEP_GRATE:
        {
            switch(
irand)
            {
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_grate1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_grate3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_grate2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_grate4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        case 
STEP_TILE:
        {
            if ( !
random_num(0,4) ) 
                
irand 4;
            switch(
irand)
            {
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_tile1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_tile3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_tile2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_tile4.wav"fvolATTN_NORM0PITCH_NORM );
                case 
4emit_soundiPlayerCHAN_BODY"player/pl_tile5.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        case 
STEP_SLOSH:
        {
            switch(
irand)
            {    
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_slosh1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_slosh3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_slosh2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_slosh4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        case 
STEP_WADE:
        {
            if ( 
iSkipStep == )
                
iSkipStep++;
            
            if ( 
iSkipStep++ == )
                
iSkipStep 0;
            
            switch(
irand)
            {
                
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_wade1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_wade2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_wade3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_wade4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        case 
STEP_LADDER:
        {
            switch(
irand)
            {                
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_ladder1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_ladder3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_ladder2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_ladder4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        default:
        {
            switch(
irand)
            {
                case 
0emit_soundiPlayerCHAN_BODY"player/pl_step1.wav"fvolATTN_NORM0PITCH_NORM );
                case 
1emit_soundiPlayerCHAN_BODY"player/pl_step3.wav"fvolATTN_NORM0PITCH_NORM );
                case 
2emit_soundiPlayerCHAN_BODY"player/pl_step2.wav"fvolATTN_NORM0PITCH_NORM );
                case 
3emit_soundiPlayerCHAN_BODY"player/pl_step4.wav"fvolATTN_NORM0PITCH_NORM );
            }
        }
        
    }
    
    return 
OrpheuIgnored;
}

public 
msg_TeamInfomsg_idmsg_dest )
{
    if ( 
msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST )
        return;
    
    static 
idteam];
    
id get_msg_arg_int);
    
get_msg_arg_string2team);
    
    switch( 
team[0] )
    {
        case 
'T'g_iTeam[id] = 1;
        case 
'C'g_iTeam[id] = 2;
        
//case 'S': g_iTeam[id] = 3;
        
default:  g_iTeam[id] = 0;
    }



nikhilgupta345 07-01-2011 12:07

Re: Jump sound
 
Does that completely block the jumping sounds or just play a sound over it?


All times are GMT -4. The time now is 07:27.

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