AlliedModders

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

John6000 01-19-2007 17:09

unregister_clcmd
 
hello :)

After i have registed a command e.g.:

register_clcmd("zat_on","block_zaton",ADMIN_M AP)

is there a way to unregister it?

unregister_clcmd("zat_on") :up: = what i want but it doesnt exist


ty in advance

[ --<-@ ] Black Rose 01-19-2007 17:19

Re: unregister_clcmd
 
Maby you could overwrite it, to change the called func to an empty one. I don't know if it will work though.
Code:
register_clcmd("zat_on", "nothing") public nothing() {     // nothing...   }

John6000 01-19-2007 17:39

Re: unregister_clcmd
 
doesnt work :(

John6000 01-19-2007 17:57

Re: unregister_clcmd
 
i've looked at it again and it seems the second time on registering a clcmd it ignores it, it only lisens to the register_clcmd the 1st time, perhaps a amxx bug?

[ --<-@ ] Black Rose 01-19-2007 18:03

Re: unregister_clcmd
 
Nawh, seems pretty logical, if the command allready exist it probably wont overwrite it.

Just make a global/cvar check on the beginning of that function if (c)var is 1 continue with func. if not, return.

John6000 01-19-2007 18:13

Re: unregister_clcmd
 
xD i dont know how to script that please can you give an example, pleease

thank you very very very much! your help is much appreciated

[ --<-@ ] Black Rose 01-19-2007 18:17

Re: unregister_clcmd
 
Code:
#include <amxmodx> #include <amxmisc> new bool:g_cmd_activated = true public plugin_init() {     register_clcmd("zat_on","block_zaton",ADMIN_MAP) } public block_zaton(id, level, cid) {     if ( ! g_cmd_activated )         return     if ( ! cmd_access(id, level, cid, 0) )         return     // ... }

dutchmeat 01-19-2007 19:05

Re: unregister_clcmd
 
Rose, you know how to do this...
Code:


register_clcmd("zat_on", "nothing")

public nothing() {
    return PLUGIN_HANDLED

    // nothing... 
}

returning is the almost same result as returning plugin_continue

[ --<-@ ] Black Rose 01-20-2007 16:41

Re: unregister_clcmd
 
Quote:

Originally Posted by dutchmeat (Post 429312)
Rose, you know how to do this...
Code:


register_clcmd("zat_on", "nothing")

public nothing() {
    return PLUGIN_HANDLED

    // nothing... 
}

returning is the almost same result as returning plugin_continue

Your point being?

John6000 01-21-2007 07:51

Re: unregister_clcmd
 
I got this working in the end =) thanks for your help people i have given you all karma


All times are GMT -4. The time now is 22:20.

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