Raised This Month: $51 Target: $400
 12% 

Play .wav when someonay says a word...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TiToTal
Member
Join Date: Feb 2006
Old 03-13-2006 , 19:50   Play .wav when someonay says a word...
Reply With Quote #1

I think it's not hard...

I need to know how I can make a .wav sound plays when someone says a specific word... But, it has to play for everyone close to this person...

Code:
if(containi(said,"theword") != -1) {     ??? }

I only know this peace of code

can someone plz help me?
TiToTal is offline
kinsprite2
Junior Member
Join Date: Mar 2006
Old 03-14-2006 , 03:19  
Reply With Quote #2

Code:
public plugin_precache() { if (file_exists("sound/misc/woohoo.wav"))         precache_sound("misc/woohoo.wav") } public plugin_init() { ..........................         register_clcmd("say","check_say")     register_clcmd("say_team","check_say") } public check_say(id){ .................. clsaywh(id)     return PLUGIN_CONTINUE } public clsaywh(id) {     if (!is_user_alive(id)) {         client_print(id,print_chat,"%L", id, "NOTALIVE")         return  PLUGIN_HANDLED        }     if (file_exists("sound/misc/woohoo.wav"))         emit_sound(id,CHAN_STATIC, "misc/woohoo.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)       return  PLUGIN_HANDLED        }
just like this
kinsprite2 is offline
TiToTal
Member
Join Date: Feb 2006
Old 03-14-2006 , 14:26  
Reply With Quote #3

Quote:
Originally Posted by kinsprite2
Code:
public plugin_precache() { if (file_exists("sound/misc/woohoo.wav"))         precache_sound("misc/woohoo.wav") } public plugin_init() { ..........................         register_clcmd("say","check_say")     register_clcmd("say_team","check_say") } public check_say(id){ .................. clsaywh(id)     return PLUGIN_CONTINUE } public clsaywh(id) {     if (!is_user_alive(id)) {         client_print(id,print_chat,"%L", id, "NOTALIVE")         return  PLUGIN_HANDLED        }     if (file_exists("sound/misc/woohoo.wav"))         emit_sound(id,CHAN_STATIC, "misc/woohoo.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)       return  PLUGIN_HANDLED        }
just like this

O.O

is this plugin going to emit the sound only when some specific word is said?
TiToTal is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-14-2006 , 14:33  
Reply With Quote #4

Quote:
is this plugin
This is not a plugin but a code snippet (example).
VEN is offline
TiToTal
Member
Join Date: Feb 2006
Old 03-14-2006 , 15:54  
Reply With Quote #5

Quote:
Originally Posted by VEN
Quote:
is this plugin
This is not a plugin but a code snippet (example).

yes, I know, thanks for correcting me... =P I make this mistakes normally, I don't speak english perfectly so I may get some mistakes...

I know.. so change my question to: "is this code... ?"
TiToTal is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-14-2006 , 16:08  
Reply With Quote #6

would this really work?
Code:
public plugin_precache() { if (file_exists("sound/misc/woohoo.wav"))         precache_sound("misc/woohoo.wav") }
the file_exist is totally unecessary and if it wold be there, there would be an ! in front of it
[ --<-@ ] Black Rose is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 03-14-2006 , 16:17  
Reply With Quote #7

Quote:
Originally Posted by [ --<-@
Black Rose]would this really work?
Code:
public plugin_precache() { if (file_exists("sound/misc/woohoo.wav"))         precache_sound("misc/woohoo.wav") }
the file_exist is totally unecessary and if it wold be there, there would be an ! in front of it
Putting a '!' in front of the if statement would precache the sound if it DIDN'T exist. Which would then make it truely unecssary.
Why? It prevents the server from crashing if it does not have it. But, you should make it print a warning message if its not precached to let the server know so they can add it.

Just in case somebody wants to argue
Quote:
file_exists - Checks if a file exists (returns 1 on success, 0 on failure).
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 03-14-2006 , 16:18  
Reply With Quote #8

"file_exist" is necessary
Code:
 public plugin_precache() { 
        precache_sound("misc/woohoo.wav") 
}
this code would produce an error if wav is missing
so check if such file exists before using it
__________________
alias White Panther
karlos is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-14-2006 , 16:21  
Reply With Quote #9

oh, i thought it was client side
so if the file was found on client then dl, if not no dl.
sry
[ --<-@ ] Black Rose is offline
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 03-14-2006 , 16:25  
Reply With Quote #10

precache = load file
if client cannot load it, download it and then load it
__________________
alias White Panther
karlos 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 12:28.


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