Raised This Month: $ Target: $400
 0% 

[HELP] Need Plugin Music


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 08-20-2016 , 08:40   Re: [HELP] Need Plugin Music
Reply With Quote #1

PHP Code:
#include <amxmodx>

#define MUSIC_TIME 150 //Put here length of your sound track , for example if it has 1:20 minutes then put 80 (seconds)
#define REPEAT_TIMES 3 //How many times track repeats per round

new const g_sz_Music_File[] = "sound/music/my_track.mp3"//change your directory or filename which you want

public plugin_precache () 
{
    
precache_genericg_sz_Music_File );
}

public 
plugin_init () 
{
    
register_plugin "Music File Play""1.0",  "siriusmd99" );
    
register_logevent("event_Round_Start"2"1=Round_Start")  
}

public 
event_Round_Start()
{
    
remove_task()
    
set_task(float(MUSIC_TIME), "repeat_track", .flags="a", .repeat REPEAT_TIMES)
}

public 
repeat_track()
{
    
client_cmd(0"stopsound;mp3 stop"); //Stop sounds in case music time is not defined corectly or another sound started to play
    
client_cmd 0"mp3 play %s"g_sz_Music_File );

siriusmd99 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 08-20-2016 , 10:09   Re: [HELP] Need Plugin Music
Reply With Quote #2

Fixed:

PHP Code:
#include <amxmodx>

#define MUSIC_TIME 150 //Put here length of your sound track , for example if it has 1:20 minutes then put 80 (seconds)
#define REPEAT_TIMES 3 //How many times track repeats per round

new const g_sz_Music_File[] = "sound/music/my_track.mp3"//change your directory or filename which you want

public plugin_precache () 
{
    
precache_genericg_sz_Music_File );
}

public 
plugin_init () 
{
    
register_plugin "Music File Play""1.0",  "siriusmd99" );
    
register_logevent("event_Round_Start"2"1=Round_Start");  
}

public 
event_Round_Start()
{
    
remove_task();
    
repeat_track();
    
set_task(float(MUSIC_TIME), "repeat_track", .flags="a", .repeat REPEAT_TIMES );
}

public 
repeat_track()
{
    
client_cmd(0"stopsound;mp3 stop"); //Stop sounds in case music time is not defined corectly or another sound started to play
    
client_cmd 0"mp3 play %s"g_sz_Music_File );


Last edited by siriusmd99; 08-20-2016 at 10:10.
siriusmd99 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 23:29.


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