Quote:
Originally Posted by Voi
untested, but this should work like you want it:
<code>
|
No.
Code:
#include <amxmodx>
#include <cstrike>
new mp3list[][] =
{
"file1.mp3",
"file2.mp3",
"file3.mp3",
"file4.mp3"
}
new bool:b_Allow[33]
public plugin_init()
{
register_plugin( "Sounds", "1.1", "Wrecked" )
register_logevent( "LogEventRoundEnd", 2, "1=Round_End" )
register_event( "DeathMsg", "EventDeathMsg", "a" )
register_clcmd( "say /allowmusic", "CmdSwitchAllow" )
register_clcmd( "say_team /allowmusic", "CmdSwitchAllow" )
}
public client_connect( id )
{
b_Allow[id] = true
}
public CmdSwitchAllow( id )
{
b_Allow[id] = b_Allow[id] ? false : true
client_print( id, print_chat, "Death Sounds Enabled: %s", b_Allow[id] ? "Enabled" : "Disabled" )
return PLUGIN_HANDLED;
}
public LogEventRoundEnd()
{
client_cmd( 0, "mp3 stop" )
}
public EventDeathMsg()
{
new victim = read_data( 2 )
new CsTeams:victeam = cs_get_user_team( victim )
new iPlayers[32]
new iNum
get_players( iPlayers, iNum )
new id
new rnum = random( sizeof mp3list )
for( new i = 0; i < iNum; i++ )
{
id = iPlayers[i]
if( is_user_alive( id ) && ( id != victim ) && b_Allow[id] && ( victeam == cs_get_user_team( id ) ) )
{
client_cmd( id, "mp3 play %s", mp3list[rnum] )
}
}
}
This one won't play the sound to the victim. You said you only wanted it to the victim's team. If you'd like it to play to the victim as well, just let me know.
__________________