AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   PLay sound on 10 second remaining (https://forums.alliedmods.net/showthread.php?t=54869)

flyeni6 05-06-2007 01:11

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

thanks

_Master_ 05-08-2007 04:43

Re: PLay sound on 10 second remaining
 
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")

flyeni6 05-11-2007 18:52

Re: PLay sound on 10 second remaining
 
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") }

Arkshine 05-11-2007 19:36

Re: PLay sound on 10 second remaining
 
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" );

flyeni6 05-12-2007 01:34

Re: PLay sound on 10 second remaining
 
thx for ur help but it doesnt wrk

Arkshine 05-12-2007 01:52

Re: PLay sound on 10 second remaining
 
I've just tried with "set_task( 10.0, "timesounds", 0, _, _, "d" );" and it works fine.

flyeni6 05-12-2007 17:20

Re: PLay sound on 10 second remaining
 
Quote:

Originally Posted by arkshine (Post 475770)
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

Arkshine 05-12-2007 17:36

Re: PLay sound on 10 second remaining
 
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?

flyeni6 05-12-2007 17:47

Re: PLay sound on 10 second remaining
 
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!") }

Arkshine 05-12-2007 17:58

Re: PLay sound on 10 second remaining
 
Move set_task in plugin_init() .

No need to use ResetHud.


All times are GMT -4. The time now is 06:41.

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