Raised This Month: $ Target: $400
 0% 

Play MP3 to victims teammates only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-15-2010 , 12:59   Re: Play MP3 to victims teammates only
Reply With Quote #1

untested, but this should work like you want it:
Code:
#include <amxmodx>
#include <cstrike>

#define music 4

new g_MaxPlayers;

new mp3list[music][] = 
{
"file1.mp3",
"file2.mp3",
"file3.mp3",
"file4.mp3"
}

public plugin_init ()
{
register_plugin( "Sound On Death", "1.0", "Biscuit" );
register_event( "DeathMsg", "Event_PlayerKilled", "a" );
register_logevent("round_end_event", 2, "1=Round_End");
g_MaxPlayers = get_maxplayers();
}

public round_end_event()
client_cmd(0,"mp3 stop");

public Event_PlayerKilled (id)
{
    new r = random_num(0,music-1);
    new VictimTeam = get_user_team(id)
    for (new Client = 1; Client <= g_MaxPlayers; Client++)
    {
        if (!is_user_connected(Client))
            continue;
        
        if(is_user_alive(Client))
        {
            new ClientTeam = get_user_team(Client)
            switch(ClientTeam)
        {
            case 1: // Terrorist
            {
                if(Client != id && ClientTeam == VictimTeam)
                    client_cmd(id,"mp3 play %s",mp3list[r]);
            }
            case 2: // CT
            {
                if(Client != id && ClientTeam == VictimTeam)
                    client_cmd(id,"mp3 play %s",mp3list[r]);
            }
        }
        }
        
        
    }
}
edit:
i missed something, hold on
edit2:
*should* be ok now
__________________

Last edited by Voi; 05-15-2010 at 13:05.
Voi is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-15-2010 , 13:15   Re: Play MP3 to victims teammates only
Reply With Quote #2

Quote:
Originally Posted by Voi View Post
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.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 05-15-2010 at 14:00.
wrecked_ is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 05-15-2010 , 13:20   Re: Play MP3 to victims teammates only
Reply With Quote #3

Forgot to ment that dead people should not hear any sound at all.
Rirre is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-15-2010 , 13:22   Re: Play MP3 to victims teammates only
Reply With Quote #4

Quote:
Originally Posted by Rirre View Post
Forgot to ment that dead people should not hear any sound at all.
Yep, that's there, too.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 05-15-2010 , 13:51   Re: Play MP3 to victims teammates only
Reply With Quote #5

Thx guys, wrecked_'s version works
EDIT: Could you make a cmd for user(s) to disable which don't want to hear them all the time?

Last edited by Rirre; 05-15-2010 at 13:56.
Rirre is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-15-2010 , 14:00   Re: Play MP3 to victims teammates only
Reply With Quote #6

Quote:
Originally Posted by Rirre View Post
Could you make a cmd for user(s) to disable which don't want to hear them all the time?
Done. Post edited.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 05-15-2010 , 14:17   Re: Play MP3 to victims teammates only
Reply With Quote #7

Thanks
Rirre 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 03:49.


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