Raised This Month: $240 Target: $400
 60% 

[Request] Remode sounds from plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
z4rk
Member
Join Date: Aug 2019
Old 11-13-2021 , 04:18   [Request] Remode sounds from plugin
Reply With Quote #1

Hi, I would like to remove all the sounds from a plugin, but keep everything (hud and kill fade) exactly the same. It's a simple plugin that counts kills and headshots + screen fade. Here is the source code:
PHP Code:
#include < amxmodx >
#include < amxmisc >

new const src_sound [ ][ ] =
{
    
"Effects/ha.mp3",
    
"Effects/roundend/1.mp3""Effects/roundend/2.mp3",
    
"Effects/roundend/3.mp3""Effects/roundend/4.mp3",
    
"Effects/roundend/5.mp3""Effects/roundend/6.mp3",
    
"Effects/roundend/7.mp3""Effects/roundend/8.mp3",
    
"Effects/roundend/9.mp3""Effects/roundend/10.mp3",
    
"Effects/roundend/11.mp3""Effects/roundend/12.mp3",
    
"Effects/roundend/13.mp3""Effects/roundend/14.mp3",
    
"Effects/roundend/15.mp3""Effects/roundend/16.mp3",
    
"Effects/roundend/17.mp3""Effects/roundend/18.mp3",
    
"Effects/roundend/19.mp3""Effects/roundend/20.mp3",
    
"Effects/roundend/21.mp3""Effects/roundend/22.mp3"
}

enum _:ustats
{
    
killsheads
}

new 
UserData 33 ][ ustats ], objHud

public plugin_init ( )
{
    
register_plugin "Effects plug-in""1.0""OverGame" )
    
    
register_event "DeathMsg""EventKilling""a""1>0" )
    
    
register_logevent "logevent_round_start"2"1=Round_Start" )
    
register_logevent "logevent_round_end"2"1=Round_End" )
    
    
register_cvar "effects_screen""1" )
    
register_cvar "effects_screen_sound""1" )
    
register_cvar "effects_killing_count""1" )
    
register_cvar "effects_roundend_sound""1" )
    
    
objHud CreateHudSyncObj ( )
    
plugin_cfg ()
        
    if ( 
get_cvar_num "effects_killing_count" ) )
        
set_task 1.0"killing_count"___"b" )
}

public 
plugin_cfg ( )
{
    new 
szCfgDir 64 ], szFile 192 ]
    
get_configsdir szCfgDircharsmax szCfgDir ) )
    
formatex szFilecharsmax szFile ), "%s/Effects/effects.cfg"szCfgDir )
    if ( 
file_exists szFile ) )
        
server_cmd "exec %s"szFile )
}

public 
plugin_precache ( )
{
    for ( new 
isizeof src_sound ); i++ )
        
precache_sound src_sound ] )
}

public 
client_putinserver id )
{
    
UserData id ][ kills ] = 0
    UserData 
id ][ heads ] = 0
}

public 
logevent_round_start ( )
{
    for ( new 
idid <= get_maxplayers ( ); id++ )
    {
        
UserData id ][ kills ] = 0
        UserData 
id ][ heads ] = 0
    
}
}
    
public 
logevent_round_end ( )
{
    if ( 
get_cvar_num "effects_roundend_sound" ) )
    {
        new 
snd_round random_num 1sizeof src_sound ) - )
        for ( new 
idid <= get_maxplayers ( ); id++ )
            
client_cmd id"mp3 play sound/%s"src_sound snd_round ] )
    }
    
    return 
PLUGIN_CONTINUE
}

public 
EventKilling ( )
{
    new 
iKiller read_data )
    new 
iVictim read_data )
    new 
iHead read_data )
    
    if ( 
get_cvar_num "effects_killing_count" ) )
    {
        if ( 
iHead )
        {
            
UserData iKiller ][ kills ]++
            
UserData iKiller ][ heads ]++
        } else {
            
UserData iKiller ][ kills ]++
        }
    }
    
    if ( 
get_cvar_num "effects_screen_sound" ) )
        
client_cmd iVictim"mp3 play sound/%s"src_sound ] )
        
    if ( 
get_cvar_num "effects_screen" ) )
        
show_screen iVictim2550)
    if ( 
get_cvar_num "effects_screen" ) )
        
show_screen iKiller0255)
        
    return 
PLUGIN_HANDLED
}

public 
killing_count ( )
{
    for ( new 
id 0id <= get_maxplayers ( ); id++ )
    {
        if ( !
is_user_bot id ) && is_user_connected id ) && UserData id ][ kills ] > || UserData id ][ heads ] > )
        {
            new 
buffer 128 ], len
            set_hudmessage 
1001001000.060.704.01.0__, -)    
            
            
len format buffercharsmax buffer ), "Kills: %d^n"UserData id ][ kills ] )
            
len += format buffer len ], charsmax buffer ) - len"Headshots: %d"UserData id ][ heads ] )
            
ShowSyncHudMsg idobjHudbuffer )
        }
    }
    
    return 
PLUGIN_CONTINUE
}

stock show_screen ( const id, const r, const g, const )
{
    
message_begin MSG_ONEget_user_msgid "ScreenFade" ) , { 00}, id )
    
write_short 1<<10 )
    
write_short 1<<10 )
    
write_short 0x0000 )
    
write_byte )
    
write_byte )
    
write_byte )
    
write_byte 100 )
    
message_end ()

I tried to remove the cvars for sounds and everything from:

PHP Code:
new const src_sound [ ][ ] =
public 
plugin_precache ( )
public 
logevent_round_end ( ) 
But after that, Kill + Headshot counts no longer appears. Also, the screen fade is no longer appears. I want to remove the sounds because I will use the plugin on a CSDM server, and roundend sounds are useless there, people just wait to download them for no reason.

Can someone help me? Thanks!

Last edited by z4rk; 11-13-2021 at 04:41.
z4rk is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Location: Tunisia
Old 11-13-2021 , 05:12   Re: [Request] Remode sounds from plugin
Reply With Quote #2

Try this:

PHP Code:
#include < amxmodx >
#include < amxmisc >

new const src_sound [ ] = "Effects/ha.mp3"

enum _:ustats
{
    
killsheads
}

new 
UserData 33 ][ ustats ], objHud

public plugin_init ( )
{
    
register_plugin "Effects plug-in""1.0""OverGame" )
    
    
register_event "DeathMsg""EventKilling""a""1>0" )
    
    
register_logevent "logevent_round_start"2"1=Round_Start" )
    
    
register_cvar "effects_screen""1" )
    
register_cvar "effects_screen_sound""1" )
    
register_cvar "effects_killing_count""1" )
    
    
objHud CreateHudSyncObj ( )
    
plugin_cfg ()
        
    if ( 
get_cvar_num "effects_killing_count" ) )
        
set_task 1.0"killing_count"___"b" )
}

public 
plugin_cfg ( )
{
    new 
szCfgDir 64 ], szFile 192 ]
    
get_configsdir szCfgDircharsmax szCfgDir ) )
    
formatex szFilecharsmax szFile ), "%s/Effects/effects.cfg"szCfgDir )
    if ( 
file_exists szFile ) )
        
server_cmd "exec %s"szFile )
}

public 
plugin_precache ( )
{
    
precache_sound src_sound )
}

public 
client_putinserver id )
{
    
UserData id ][ kills ] = 0
    UserData 
id ][ heads ] = 0
}

public 
logevent_round_start ( )
{
    for ( new 
idid <= get_maxplayers ( ); id++ )
    {
        
UserData id ][ kills ] = 0
        UserData 
id ][ heads ] = 0
    
}
}

public 
EventKilling ( )
{
    new 
iKiller read_data )
    new 
iVictim read_data )
    new 
iHead read_data )
    
    if ( 
get_cvar_num "effects_killing_count" ) )
    {
        if ( 
iHead )
        {
            
UserData iKiller ][ kills ]++
            
UserData iKiller ][ heads ]++
        } else {
            
UserData iKiller ][ kills ]++
        }
    }
    
    if ( 
get_cvar_num "effects_screen_sound" ) )
        
client_cmd iVictim"mp3 play sound/%s"src_sound )
        
    if ( 
get_cvar_num "effects_screen" ) )
        
show_screen iVictim2550)
    if ( 
get_cvar_num "effects_screen" ) )
        
show_screen iKiller0255)
        
    return 
PLUGIN_HANDLED
}

public 
killing_count ( )
{
    for ( new 
id 0id <= get_maxplayers ( ); id++ )
    {
        if ( !
is_user_bot id ) && is_user_connected id ) && UserData id ][ kills ] > || UserData id ][ heads ] > )
        {
            new 
buffer 128 ], len
            set_hudmessage 
1001001000.060.704.01.0__, -)    
            
            
len format buffercharsmax buffer ), "Kills: %d^n"UserData id ][ kills ] )
            
len += format buffer len ], charsmax buffer ) - len"Headshots: %d"UserData id ][ heads ] )
            
ShowSyncHudMsg idobjHudbuffer )
        }
    }
    
    return 
PLUGIN_CONTINUE
}

stock show_screen ( const id, const r, const g, const )
{
    
message_begin MSG_ONEget_user_msgid "ScreenFade" ) , { 00}, id )
    
write_short 1<<10 )
    
write_short 1<<10 )
    
write_short 0x0000 )
    
write_byte )
    
write_byte )
    
write_byte )
    
write_byte 100 )
    
message_end ()

__________________
JusTGo is offline
z4rk
Member
Join Date: Aug 2019
Old 11-13-2021 , 05:36   Re: [Request] Remode sounds from plugin
Reply With Quote #3

It works, but it remains a sound for download: ha.mp3. I think is from:

PHP Code:
    if ( get_cvar_num "effects_screen_sound" ) )
        
client_cmd iVictim"mp3 play sound/%s"src_sound 
I would like to remove it too.
z4rk is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Location: Tunisia
Old 11-13-2021 , 05:46   Re: [Request] Remode sounds from plugin
Reply With Quote #4

Thought you only wanted to remove round end sounds, try this, all sounds removed now:

PHP Code:
#include < amxmodx >
#include < amxmisc >

enum _:ustats
{
    
killsheads
}

new 
UserData 33 ][ ustats ], objHud

public plugin_init ( )
{
    
register_plugin "Effects plug-in""1.0""OverGame" )
    
    
register_event "DeathMsg""EventKilling""a""1>0" )
    
    
register_logevent "logevent_round_start"2"1=Round_Start" )
    
    
register_cvar "effects_screen""1" )
    
register_cvar "effects_killing_count""1" )
    
    
objHud CreateHudSyncObj ( )
    
plugin_cfg ()
        
    if ( 
get_cvar_num "effects_killing_count" ) )
        
set_task 1.0"killing_count"___"b" )
}

public 
plugin_cfg ( )
{
    new 
szCfgDir 64 ], szFile 192 ]
    
get_configsdir szCfgDircharsmax szCfgDir ) )
    
formatex szFilecharsmax szFile ), "%s/Effects/effects.cfg"szCfgDir )
    if ( 
file_exists szFile ) )
        
server_cmd "exec %s"szFile )
}

public 
client_putinserver id )
{
    
UserData id ][ kills ] = 0
    UserData 
id ][ heads ] = 0
}

public 
logevent_round_start ( )
{
    for ( new 
idid <= get_maxplayers ( ); id++ )
    {
        
UserData id ][ kills ] = 0
        UserData 
id ][ heads ] = 0
    
}
}

public 
EventKilling ( )
{
    new 
iKiller read_data )
    new 
iVictim read_data )
    new 
iHead read_data )
    
    if ( 
get_cvar_num "effects_killing_count" ) )
    {
        if ( 
iHead )
        {
            
UserData iKiller ][ kills ]++
            
UserData iKiller ][ heads ]++
        } else {
            
UserData iKiller ][ kills ]++
        }
    }
        
    if ( 
get_cvar_num "effects_screen" ) )
        
show_screen iVictim2550)
    if ( 
get_cvar_num "effects_screen" ) )
        
show_screen iKiller0255)
        
    return 
PLUGIN_HANDLED
}

public 
killing_count ( )
{
    for ( new 
id 0id <= get_maxplayers ( ); id++ )
    {
        if ( !
is_user_bot id ) && is_user_connected id ) && UserData id ][ kills ] > || UserData id ][ heads ] > )
        {
            new 
buffer 128 ], len
            set_hudmessage 
1001001000.060.704.01.0__, -)    
            
            
len format buffercharsmax buffer ), "Kills: %d^n"UserData id ][ kills ] )
            
len += format buffer len ], charsmax buffer ) - len"Headshots: %d"UserData id ][ heads ] )
            
ShowSyncHudMsg idobjHudbuffer )
        }
    }
    
    return 
PLUGIN_CONTINUE
}

stock show_screen ( const id, const r, const g, const )
{
    
message_begin MSG_ONEget_user_msgid "ScreenFade" ) , { 00}, id )
    
write_short 1<<10 )
    
write_short 1<<10 )
    
write_short 0x0000 )
    
write_byte )
    
write_byte )
    
write_byte )
    
write_byte 100 )
    
message_end ()

__________________
JusTGo is offline
z4rk
Member
Join Date: Aug 2019
Old 11-13-2021 , 06:01   Re: [Request] Remode sounds from plugin
Reply With Quote #5

Perfect! Thank you very much!
z4rk is offline
Reply


Thread Tools
Display Modes

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 00:07.


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