AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with say commands (https://forums.alliedmods.net/showthread.php?t=27963)

wonsae 05-03-2006 18:26

problem with say commands
 
hi i'm having a problem with say commands like
Code:
register_clcmd("say /test","test")
I made a test plugin
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "beta1" #define AUTHOR "wonsae" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /test","test") } public test(id){     client_print(id,print_chat,"TestTEST!")     return PLUGIN_HANDLED }

but when i say /test it doens't do anything at all just shows /test as i said it

KoST 05-03-2006 18:31

im not sure, but i think
Code:
return PLUGIN_HANDLED
blocks the client_print
try:
Code:
return PLUGIN_CONTINUE

wonsae 05-03-2006 18:37

Nope it does the same thing
edit: not even console commands work now :\

v3x 05-03-2006 20:11

Code:
#include <amxmodx> public plugin_init() {   register_plugin("test" , "0.1" , "v3x");   register_clcmd("say" , "hook_say"); } public hook_say(id) {   new said[201];   read_args(said , 200);   remove_quotes(said);   if(equal(said , "/test"))   {     client_print(id , print_chat , "zomg gabster");     return PLUGIN_HANDLED; // block the text from appearing   }   return PLUGIN_CONTINUE; // let the rest of the text appear normally }

VEN 05-04-2006 10:49

wonsae: your code is fine, the problem is somewhere outside that

wonsae 05-04-2006 17:57

I know it's fine but it won't do anything

MaximusBrood 05-04-2006 18:32

@Wonsae: Your code is fine. Try disabling all your custom plugins and try again.

@V3X: That's off course another way, but he was asking why his code didn't work. Your code is more CPU-intensive too :)

organizedKaoS 05-04-2006 19:46

Code:
register_concmd("say /text", "cmdtext") public cmdtext(id) {      your code here }

This always seems to do the trick for me. Simple and all you have to do is input whatever you want into the public function tied to the say command. I have used PLUGIN_HANDLED in this type of function and it has not kept the function from running. Hope it helps you out. :up:

v3x 05-04-2006 20:32

My way is the proper way. Also, you can do more without needing to add more functions to hook other say commands :P

Emp` 05-04-2006 20:33

i dont know why, but when i was making something like this for my own uses, i had to go into console and type
Code:

say test
for some reason. but the hooksay that v3x posted makes it so you can just say test instead of going into console


All times are GMT -4. The time now is 05:09.

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