Raised This Month: $ Target: $400
 0% 

Need help with a sound script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-11-2005 , 12:18   Need help with a sound script
Reply With Quote #1

One of my first plugins. What im trying to make is when a admin types amx_sound <file name> it will get played for everyone on the server. If anybody know if there is any plugin like it already tell me... Here it is:
Code:
#include <amxmodx> plublic plugin_init() {     register_plugin("Admin Sounds", "1.0", "XunTric")     register_concmd("amx_sound", "cmdsound", ADMIN_SLAY, "<Sound name> Plays a sound for the server") } plublic cmdsound(id,level,cid) {     if(!cmd_access(id,level,cid,1))          return PLUGIN_HANDLED     server_cmd("play sound/adminsound/%s")          return PLUGIN_CONTINUE }
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-11-2005 , 16:04  
Reply With Quote #2

Try
Code:
client_cmd(0,"speak ^"sound/adminsound/%s^"");
. Although it won't work properly, since you have a %s but nothing to replace it with.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-11-2005 , 17:32  
Reply With Quote #3

Hehe i knew you would help You have been helping me with some plugins last week. But it still doesnt work. I get 7 errors when im trying to compile it.
XunTric is offline
Crazywelder1
Member
Join Date: Mar 2004
Location: CA
Old 02-11-2005 , 17:46  
Reply With Quote #4

i think u have to precache the sounds but i am not sure i am probably wrong<Avalanche am i right or way off???
Crazywelder1 is offline
Send a message via MSN to Crazywelder1
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-11-2005 , 19:33  
Reply With Quote #5

if they are custom sounds, and no one else has em, you should precache them. If they are standard, using client_cmd speak should be no problem.
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-11-2005 , 19:44  
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> plublic plugin_init() {     register_plugin("Admin Sounds", "1.0", "Teh Wooters Ate the Hooters")     register_concmd("amx_sound", "cmdsound", ADMIN_SLAY, "<Sound name> Plays a sound for the server") } plublic cmdsound(id,level,cid) { new output[64]     if(!cmd_access(id,level,cid,1)) {          return PLUGIN_HANDLED }     read_argv(1,output,63)     client_cmd(0,"speak ^"sound/adminsound/%s^"",output)     client_print(0,print_chat,"[♀] Server has made everyone listen to %s!",output)          return PLUGIN_CONTINUE } public plugin_precache() { /* precache_sound("sound/adminsound/whatever.wav") precache_sound("sound/adminsound/whatever.wav") precache_sound("sound/adminsound/whatever.wav") // Only if the client does not download the wav when they join. */

now, this should work.

Note: In the client print if u see a ♀ or a bunch of random numbers, compile anyway and see if it will work. If not, dam, you cant see my secret message
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-11-2005 , 22:45  
Reply With Quote #7

No, that won't work at all.

You declare a function "plublic" two times, have random mis-indentations, and don't close the plugin_precache with another brace. Additionally, the last parameter for cmd_access should be 2 in that case.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-12-2005 , 14:26  
Reply With Quote #8

Quote:
Originally Posted by TotalNoobScripter
Code:
#include <amxmodx> #include <amxmisc> plublic plugin_init() {     register_plugin("Admin Sounds", "1.0", "Teh Wooters Ate the Hooters")     register_concmd("amx_sound", "cmdsound", ADMIN_SLAY, "<Sound name> Plays a sound for the server") } plublic cmdsound(id,level,cid) { new output[64]     if(!cmd_access(id,level,cid,1)) {          return PLUGIN_HANDLED }     read_argv(1,output,63)     client_cmd(0,"speak ^"sound/adminsound/%s^"",output)     client_print(0,print_chat,"[♀] Server has made everyone listen to %s!",output)          return PLUGIN_CONTINUE } public plugin_precache() { /* precache_sound("sound/adminsound/whatever.wav") precache_sound("sound/adminsound/whatever.wav") precache_sound("sound/adminsound/whatever.wav") // Only if the client does not download the wav when they join. */

now, this should work.

Note: In the client print if u see a ♀ or a bunch of random numbers, compile anyway and see if it will work. If not, dam, you cant see my secret message
Didnt work still get 6 errors. Why did you post your own name in the plugin?
And yes, its custom sounds.
Can i use mp3 files also?
XunTric is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 02-12-2005 , 14:39  
Reply With Quote #9

Code:
#include <amxmodx> #include <amxmisc> plublic plugin_init() {     register_plugin("Admin Sounds", "1.0", "Teh Wooters Ate the Hooters")     register_concmd("amx_sound", "cmdsound", ADMIN_SLAY, "<Sound name> Plays a sound for the server") } plublic cmdsound(id,level,cid) { new output[64]     if(!cmd_access(id,level,cid,1)) {          return PLUGIN_HANDLED }     read_argv(1,output,63)     client_cmd(0,play "adminsound/%s", output)     client_print(0,print_chat,"[♀] Server has made everyone listen to %s!",output) }          return PLUGIN_CONTINUE } public plugin_precache() { /* precache_sound("sound/adminsound/whatever.wav") precache_sound("sound/adminsound/whatever.wav") precache_sound("sound/adminsound/whatever.wav") // Only if the client does not download the wav when they join. */

play command starts in the sound folder... precache might too
__________________
Anything that is done can only be done better by urself - since life is a opinion make it the way urs feel its best

~live by it
Da Bishop is offline
Send a message via MSN to Da Bishop
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-12-2005 , 14:44  
Reply With Quote #10

Teh Wooters Ate Teh Hooters was a joke...
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
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 19:21.


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