Raised This Month: $ Target: $400
 0% 

unregister_clcmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
John6000
Junior Member
Join Date: Nov 2006
Old 01-19-2007 , 17:09   unregister_clcmd
Reply With Quote #1

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") = what i want but it doesnt exist


ty in advance
John6000 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-19-2007 , 17:19   Re: unregister_clcmd
Reply With Quote #2

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...   }
[ --<-@ ] Black Rose is offline
John6000
Junior Member
Join Date: Nov 2006
Old 01-19-2007 , 17:39   Re: unregister_clcmd
Reply With Quote #3

doesnt work
John6000 is offline
John6000
Junior Member
Join Date: Nov 2006
Old 01-19-2007 , 17:57   Re: unregister_clcmd
Reply With Quote #4

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?
John6000 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-19-2007 , 18:03   Re: unregister_clcmd
Reply With Quote #5

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.
[ --<-@ ] Black Rose is offline
John6000
Junior Member
Join Date: Nov 2006
Old 01-19-2007 , 18:13   Re: unregister_clcmd
Reply With Quote #6

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
John6000 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-19-2007 , 18:17   Re: unregister_clcmd
Reply With Quote #7

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     // ... }
[ --<-@ ] Black Rose is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-19-2007 , 19:05   Re: unregister_clcmd
Reply With Quote #8

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
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-20-2007 , 16:41   Re: unregister_clcmd
Reply With Quote #9

Quote:
Originally Posted by dutchmeat View Post
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?
[ --<-@ ] Black Rose is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-21-2007 , 11:20   Re: unregister_clcmd
Reply With Quote #10

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
Your point being?
My point is that you only hook the command, and then returning...
while return plugin_handled stops the command's functionality
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
Reply



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 22:20.


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