Raised This Month: $ Target: $400
 0% 

PLay sound on 10 second remaining


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 05-06-2007 , 01:11   PLay sound on 10 second remaining
Reply With Quote #1

how can i make it so that if there is 10 seconds left in the server a sound will play?

thanks
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
_Master_
Senior Member
Join Date: Dec 2006
Old 05-08-2007 , 04:43   Re: PLay sound on 10 second remaining
Reply With Quote #2

Quote:
set_task ( Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0 )
Flags:
"a" - repeat.
"b" - loop task.
"c" - do task on time after a map timeleft.
"d" - do task on time before a map timelimit.
Code:
set_task(10.0, "<function_name_here>", _, _, _, "d")
_Master_ is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 05-11-2007 , 18:52   Re: PLay sound on 10 second remaining
Reply With Quote #3

ok when i did it like this, it just keeps repeating and never stop.
why?
Code:
public testsounds(id) {  set_task(240.0, "timesounds", _, _, _, "d")  return PLUGIN_CONTINUE  }   } public timesounds(id) {  client_cmd(id,"mp3 play sound/halomod/thirty_seconds_remaining.mp3")  set_hudmessage(42, 170, 255, 0.04, 0.17, 0, 6.0, 12.0);  show_hudmessage(id, "30 sec remaining")  client_print(0,print_chat,"30 sec remaining") }
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-11-2007 , 19:36   Re: PLay sound on 10 second remaining
Reply With Quote #4

Try this :

Code:
#include <amxmodx> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Administrateur" public plugin_init() {     register_plugin( PLUGIN, VERSION, AUTHOR );         set_task( ( get_cvar_float("mp_timelimit") * 60 ) - 10.0, "timesounds" ); } public timesounds( ) {     client_cmd( 0, "mp3 play sound/halomod/thirty_seconds_remaining.mp3" );         set_hudmessage( 42, 170, 255, 0.04, 0.17, 0, 6.0, 12.0 );     show_hudmessage( 0, "30 sec remaining" );         client_print( 0, print_chat, "30 sec remaining" ); }


Or with this, maybe be it works too.

Code:
 set_task( 10.0, "timesounds", 0, _, _, "d" );
__________________

Last edited by Arkshine; 05-11-2007 at 19:41.
Arkshine is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 05-12-2007 , 01:34   Re: PLay sound on 10 second remaining
Reply With Quote #5

thx for ur help but it doesnt wrk
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-12-2007 , 01:52   Re: PLay sound on 10 second remaining
Reply With Quote #6

I've just tried with "set_task( 10.0, "timesounds", 0, _, _, "d" );" and it works fine.
__________________
Arkshine is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 05-12-2007 , 17:20   Re: PLay sound on 10 second remaining
Reply With Quote #7

Quote:
Originally Posted by arkshine View Post
I've just tried with "set_task( 10.0, "timesounds", 0, _, _, "d" );" and it works fine.
lol my bad didnt test it right but
thank u. it works!.

but is there a way to only make it display only 1 time.

cus that displays twice
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-12-2007 , 17:36   Re: PLay sound on 10 second remaining
Reply With Quote #8

It displays one time with me.

It's not possible that it displays 2 times because "d" flag means "do task on time before a map timeleft". So...

I've tested again and it displays one time. Check your code.


What's your full code exactly?
__________________
Arkshine is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 05-12-2007 , 17:47   Re: PLay sound on 10 second remaining
Reply With Quote #9

Code:
#include <amxmodx> #include <amxmisc>   public plugin_init() { register_plugin("testsounds",1.0,"fLyEnIg") register_event("ResetHUD", "other_sounds", "b"); } public other_sounds() {  set_task(60.0, "oneminremsound", 0, _, _, "d")  set_task(30.0, "thirtysecremsound", 0, _, _, "d")  set_task(10.0, "tensecremsound", 0, _, _, "d")  set_task(1.0,"gameover", 0, _, _, "d") } public oneminremsound() {  client_cmd(0,"stopsound")  client_cmd(0,"mp3 play sound/halomod/one_minute_remaining.mp3")  set_hudmessage(42, 170, 255, 0.04, 0.17, 0, 6.0, 12.0);  show_hudmessage(0, "1 Min Remaining!")  client_print(0,print_chat,"[HALO MOD]1 Min Remaining!") } public thirtysecremsound() {  client_cmd(0,"stopsound")  client_cmd(0,"mp3 play sound/halomod/thirty_seconds_remaining.mp3")  set_hudmessage(42, 170, 255, 0.04, 0.17, 0, 6.0, 12.0);  show_hudmessage(0, "30 Seconds Remaining!")  client_print(0,print_chat,"[HALO MOD]30 Seconds Remaining!") } public tensecremsound() {  client_cmd(0,"stopsound")  client_cmd(0,"mp3 play sound/halomod/ten_seconds_remaining.mp3")  set_hudmessage(42, 170, 255, 0.04, 0.17, 0, 6.0, 12.0);  show_hudmessage(0, "10 Seconds Remaining!")  client_print(0,print_chat,"[HALOMOD]10 Seconds Remaining!") } public gameover() {  client_cmd(0,"stopsound")  client_cmd(0, "mp3 play sound/halomod/gameover.mp3")  set_hudmessage(42, 170, 255, 0.04, 0.17, 0, 6.0, 12.0);  show_hudmessage(0, "GameOver!")  client_print(0,print_chat,"[HALOMOD]GameOver!") }
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-12-2007 , 17:58   Re: PLay sound on 10 second remaining
Reply With Quote #10

Move set_task in plugin_init() .

No need to use ResetHud.
__________________
Arkshine 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 06:41.


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