Raised This Month: $32 Target: $400
 8% 

[HELP] Need Plugin Music


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dr hicham
Senior Member
Join Date: Sep 2015
Location: Morocco
Old 08-19-2016 , 19:34   [HELP] Need Plugin Music
Reply With Quote #1

Hi All
I'Need Plugin Music When Start Round The Music Start
And When The Music Has Finish , The Music Start Again In The Same Round
Please Help Me And Thanks Soo Mutch
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه

Last edited by dr hicham; 08-19-2016 at 19:34.
dr hicham is offline
pupdebox
Senior Member
Join Date: Feb 2016
Location: Wakanda
Old 08-19-2016 , 20:14   Re: [HELP] Need Plugin Music
Reply With Quote #2

As far as i understand, you want to play the music 2 times per round. Is it correct? And also, do you want to play wav or mp3. Give more details please so that people can help you fast
pupdebox is offline
dr hicham
Senior Member
Join Date: Sep 2015
Location: Morocco
Old 08-19-2016 , 20:31   Re: [HELP] Need Plugin Music
Reply With Quote #3

I Want 3 Times In The Round And I Want MP3
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
dr hicham is offline
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 #4

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
dr hicham
Senior Member
Join Date: Sep 2015
Location: Morocco
Old 08-20-2016 , 08:42   Re: [HELP] Need Plugin Music
Reply With Quote #5

Thanks Bro I Well Try It
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
dr hicham is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 08-20-2016 , 08:48   Re: [HELP] Need Plugin Music
Reply With Quote #6

Quote:
Originally Posted by dr hicham View Post
Thanks Bro I Well Try It
Did you understand that how you need to change the defines and sound file to your own?

#define MUSIC_TIME 150

150 is the time of your music track.

If it has 2 minutes then you will have 2*60 = 120
so it would be

#define MUSIC_TIME 120

ok?

Last edited by siriusmd99; 08-20-2016 at 08:49.
siriusmd99 is offline
dr hicham
Senior Member
Join Date: Sep 2015
Location: Morocco
Old 08-20-2016 , 08:56   Re: [HELP] Need Plugin Music
Reply With Quote #7

Bro The Plugin Work But
I Do Not Hear Music When The Round Start
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
dr hicham 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 #8

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
dr hicham
Senior Member
Join Date: Sep 2015
Location: Morocco
Old 08-20-2016 , 13:28   Re: [HELP] Need Plugin Music
Reply With Quote #9

Not Work
The Same Problem
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
dr hicham is offline
podboat05
Junior Member
Join Date: Aug 2016
Old 08-21-2016 , 01:12   Re: [HELP] Need Plugin Music
Reply With Quote #10

Quote:
Originally Posted by dr hicham View Post
Not Work
The Same Problem
the rate of mp3 may not be supported convert it to 22050hz then try again
podboat05 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 17:02.


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