Raised This Month: $ Target: $400
 0% 

Play Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 02-17-2007 , 20:57   Re: Play Sound
Reply With Quote #1

Uhh, nope. You might wanna read up some more on functions and stuff. Plus you didn't change anything..But add "misc/omg2"
Code:
#include <amxmodx> #define PLUGIN "TFC Sounds" #define VERSION "1.0" #define AUTHOR "Formula Zero" new yoursound public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("say","say_handle") } public plugin_precache() {      yoursound = precache_sound("DIR_TO_SOUND/sound.wav") } public say_handle(id) {     static command[33]     read_argv(1,command,32)         if(equali(command,"omg")) {               client_cmd(0,"spk dir_to_sound/mysound.wav")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
Replace the "DIR_TO_SOUND" on both the "client_cmd" and "precache_sound"
Then it should work, I also think that if the user already has the sound there isn't no need to precache it, only to make it downloadable to the clients.
Drak is offline
Send a message via MSN to Drak
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-18-2007 , 09:16   Re: Play Sound
Reply With Quote #2

This is poorly optimized, here's a slightly better way:

Code:
#include <amxmodx> #define PLUGIN "TFC Sounds" #define VERSION "1.0" #define AUTHOR "Formula Zero" new g_Sound[] = "dir/sound.wav" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("say","say_handle") } public plugin_precache()     file_exists(g_Sound) ? precache_sound(g_Sound) : set_fail_state("Could not find sound file") public say_handle(id) {     static command[33]     read_argv(1,command,32)         if(equali(command,"omg",3))     {               client_cmd(0,"spk ^"%s^"",g_Sound)         return PLUGIN_HANDLED     }         return PLUGIN_CONTINUE }

Also, if you're planning on posting this, don't. It'll get unapproved (given one of the rules being not to post something that plays a sound when someone says something).
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 07:56.


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