AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Debug help (https://forums.alliedmods.net/showthread.php?t=17215)

Kensai 08-27-2005 16:47

Debug help
 
Noobie question, how would I debug this code?
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "MP3 EAZY-E" #define VERSION "1.0" #define AUTHOR "bizzybone" public plugin_init() {     register_plugin(PLUGIN,VERSION,AUTHOR)     register_concmd("amx_playwav","cmdPlaywav",ADMIN_KICK,"<file path>") } public plugin_precache() {     precache_sound("misc/bendover.wav")     precache_sound("misc/annoy.wav") }     public cmdPlaywav(id,level,cid) {     if (!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED     }     new wav[32]     read_argv(1,wav,31)         client_cmd(0,"wav play sounds/misc/%s.wav",wav)                 return PLUGIN_HANDLED }

XunTric 08-27-2005 16:59

Re: Debug help
 
Quote:

Originally Posted by Kensai
How would I debug this code?

Start with telling us the problem

Kensai 08-27-2005 17:09

I type in the command and get "Unknown Command: wav"

Velocity36 08-27-2005 17:21

Maybe this..

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "MP3 EAZY-E" #define VERSION "1.0" #define AUTHOR "bizzybone" public plugin_init() {     register_plugin(PLUGIN,VERSION,AUTHOR)     register_concmd("amx_playwav","cmdPlaywav",ADMIN_KICK,"<file path>") } public plugin_precache() {     precache_sound("misc/bendover.wav")     precache_sound("misc/annoy.wav") } public cmdPlaywav(id,level,cid) {     if (!cmd_access(id,level,cid,1)) {         return PLUGIN_HANDLED     }         new wav[32]     read_argv(1,wav,31)         client_cmd(0,"wav play sounds/misc/%s.wav")         return PLUGIN_HANDLED }

XxAvalanchexX 08-27-2005 17:22

"wav" isn't a Half-Life command, try using this line to get it to play instead:

Code:
client_cmd(0,"spk ^"sounds/misc/%s.wav^"",wav)

Kensai 08-27-2005 17:25

Ah, okay, thanks much. I'll test it out now.

Kensai 08-27-2005 17:48

Well, I don't get the Unknown command error, but now it just doesn't do anything.

XxAvalanchexX 08-27-2005 18:36

Oh, whoops, the spk command assumes you're already in the /sounds/ directory, so just make it /misc/%s.wav

Kensai 08-27-2005 18:40

Like so?

Code:
client_cmd(0,"misc/%s.wav^"",wav)

?????

pdoubleopdawg 08-27-2005 18:46

I believe so, just make sure you precache all of the sounds you are going to use. (Which, is about everything for a free-arg command huh?, so I advise changing that.)


All times are GMT -4. The time now is 14:17.

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