AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   People lose access? (https://forums.alliedmods.net/showthread.php?t=16855)

DataMatrix 08-21-2005 14:03

People lose access?
 
On my server I made this plugin
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Hook Set", "1.0", "DataMatrix")     register_concmd("amx_hook","cmdHook",ADMIN_LEVEL_A,"0 = Disable | 1 = Enable") } public cmdHook(id,level,cid) {     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[32],name[32]     read_argv(id,arg,31)     get_user_name(id,name,31)     if (equal(arg,"0")==1) {         set_cvar_num("df_hook_on",0)     } else if (equal(arg,"1")==1) {         set_cvar_num("df_hook_on",1)     } else {         client_print(id,print_console,"[AMXX] Invalid arguement: %s",arg)     }     switch(get_cvar_num("amx_show_activity"))   {         case 1: client_print(0,print_chat,"[AMXX] ADMIN: set hook to %s",arg)         case 2: client_print(0,print_chat,"[AMXX] ADMIN %s: set hook to %s",name,arg)         }     return PLUGIN_CONTINUE }
Sometimes I will type in "amx_hook 1" and it will enable hook saying:
"[AMXX] ADMIN DataMatrix: set hook to 1"

Then maybe after a while I or other admins will try "amx_hook 0" or something and it will say:
"[AMXX] ADMIN DataMatrix: set hook to "

It doesn't disable or work most of the time, I've looked top to bottom and find no problems of my own.

Any help appreciated.

mysticssjgoku4 08-21-2005 14:18

change:
Code:
read_argv(id,arg,31)

to:
Code:
read_argv(0,arg,31)

see if that helps.

also, I'm not sure if this'll help either, but eh, you can try it:

Code:
register_cvar("df_hook_on","0",ADMIN_LEVEL_A,"0 = Disable | 1 = Enable")

DataMatrix 08-21-2005 14:41

Now it says:
"[AMXX] ADMIN DataMatrix: set hook to amx_hook"

DahVid 08-21-2005 14:43

*sigh*
read_argv(1,arg,31)

The plugin was reading amx_hook, now it should read

amx_hook *Read*

WaZZeR++ 08-21-2005 14:43

it should 1, not 0

mysticssjgoku4 08-21-2005 14:51

whoops. my bad, lol
0 is the command it-self 1+ are the arguements :P

DataMatrix 08-21-2005 14:53

Ahh, brilliant, thanks guys! :D


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

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