Raised This Month: $12 Target: $400
 3% 

Solved Removing an existing command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 09-12-2016 , 07:40   Removing an existing command
Reply With Quote #1

Is it possible to remove an existing command that was registered using RegConsoleCmd? (registered and removed through the same plugin)
__________________
retired

Last edited by shavit; 09-12-2016 at 08:41.
shavit is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-12-2016 , 07:46   Re: Removing an existing command
Reply With Quote #2

No. At least not from within SM.
psychonic is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-12-2016 , 11:17   Re: Removing an existing command
Reply With Quote #3

Maybe returning "Plugin_Continue" in the callback may or may not work as a trick/hack
__________________

Last edited by WildCard65; 09-12-2016 at 11:17.
WildCard65 is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 09-12-2016 , 12:24   Re: Removing an existing command
Reply With Quote #4

Quote:
Originally Posted by WildCard65 View Post
Maybe returning "Plugin_Continue" in the callback may or may not work as a trick/hack
Not really, as I register those in OnMapStart() after I read them from a configuration file
I ended up just making a global boolean and registering them once
__________________
retired

Last edited by shavit; 09-12-2016 at 12:24.
shavit is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 09-12-2016 , 16:18   Re: Removing an existing command
Reply With Quote #5

I could swear I've seen a plugin before that actively unhooked events and unregistered commands. I cannot for the life of me remember what it was though.
404UserNotFound is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-13-2016 , 03:22   Re: Removing an existing command
Reply With Quote #6

I've dealt with this in my easylink plugin for console. It's impossible to de-register a command created with RegConsoleCmd.

I resorted to registering all my easylink commands to the same callback and use a StringMap to manage my data.

When I need to remove a command, I remove the entry form the StringMap.
__________________
Neuro Toxin is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 09-13-2016 , 06:43   Re: Removing an existing command
Reply With Quote #7

Quote:
Originally Posted by Neuro Toxin View Post
I've dealt with this in my easylink plugin for console. It's impossible to de-register a command created with RegConsoleCmd.

I resorted to registering all my easylink commands to the same callback and use a StringMap to manage my data.

When I need to remove a command, I remove the entry form the StringMap.
That's actually what I ended up doing!
__________________
retired
shavit is offline
quake84
Junior Member
Join Date: Aug 2014
Location: Poland
Old 09-15-2016 , 09:07   Re: Removing an existing command
Reply With Quote #8

If this is your own command, you can check if it's enabled within the plugin and return Plugin_Continue if it's not.

If this is another plugin's command, try adding a command listener and returning Plugin_Handled.
quake84 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 09-15-2016 , 16:31   Re: Removing an existing command
Reply With Quote #9

I'm curious, why would you need to do this?
Mitchell is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 09-15-2016 , 16:57   Re: Removing an existing command
Reply With Quote #10

Quote:
Originally Posted by quake84 View Post
If this is another plugin's command, try adding a command listener and returning Plugin_Handled.
Fairly certain that it would have to be Plugin_Stop.
__________________
ddhoward is offline
Reply


Thread Tools
Display Modes

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 16:31.


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