Member
|
11-13-2021
, 04:18
[Request] Remode sounds from plugin
|
#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 { kills, heads }
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 ( szCfgDir, charsmax ( szCfgDir ) ) formatex ( szFile, charsmax ( szFile ), "%s/Effects/effects.cfg", szCfgDir ) if ( file_exists ( szFile ) ) server_cmd ( "exec %s", szFile ) }
public plugin_precache ( ) { for ( new i; i < sizeof ( src_sound ); i++ ) precache_sound ( src_sound [ i ] ) }
public client_putinserver ( id ) { UserData [ id ][ kills ] = 0 UserData [ id ][ heads ] = 0 }
public logevent_round_start ( ) { for ( new id; id <= 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 ( 1, sizeof ( src_sound ) - 1 ) for ( new id; id <= get_maxplayers ( ); id++ ) client_cmd ( id, "mp3 play sound/%s", src_sound [ snd_round ] ) } return PLUGIN_CONTINUE }
public EventKilling ( ) { new iKiller = read_data ( 1 ) new iVictim = read_data ( 2 ) new iHead = read_data ( 3 ) 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 [ 0 ] ) if ( get_cvar_num ( "effects_screen" ) ) show_screen ( iVictim, 255, 0, 0 ) if ( get_cvar_num ( "effects_screen" ) ) show_screen ( iKiller, 0, 255, 0 ) return PLUGIN_HANDLED }
public killing_count ( ) { for ( new id = 0; id <= get_maxplayers ( ); id++ ) { if ( !is_user_bot ( id ) && is_user_connected ( id ) && UserData [ id ][ kills ] > 0 || UserData [ id ][ heads ] > 0 ) { new buffer [ 128 ], len set_hudmessage ( 100, 100, 100, 0.06, 0.7, 0, 4.0, 1.0, _, _, -1 ) len = format ( buffer, charsmax ( buffer ), "Kills: %d^n", UserData [ id ][ kills ] ) len += format ( buffer [ len ], charsmax ( buffer ) - len, "Headshots: %d", UserData [ id ][ heads ] ) ShowSyncHudMsg ( id, objHud, buffer ) } } return PLUGIN_CONTINUE }
stock show_screen ( const id, const r, const g, const b ) { message_begin ( MSG_ONE, get_user_msgid ( "ScreenFade" ) , { 0, 0, 0 }, id ) write_short ( 1<<10 ) write_short ( 1<<10 ) write_short ( 0x0000 ) write_byte ( r ) write_byte ( g ) write_byte ( b ) 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.
|
|