Raised This Month: $ Target: $400
 0% 

Fixing Plugin Confliction


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 01-02-2006 , 04:54  
Reply With Quote #4

Ah, no, well.

Both plugins register a client command ("give" and "freegun") and map it to their cmd_weapon public function. Yes, there are two of them, but they don't conflict because each one is in another plugin and they are mapped to two different clcmds. What WOULD conflict is if both plugins used the same command name (ie. the first parameter of register_clcmd was the same).

Well at least they shouldn't conflict, I just woke up and I'm confused.


Anyway, let's go on. What would happen if you returned PLUGIN_CONTINUE ? Let's go from the beginning (talking about client commands). Here is an example:

Plugin A registers client command hello
Plugin B registers client command hello (later than plugin A)

Okay, the simplest case is that plugin A returns PLUGIN_HANDLED from its handler. plugin B's handler won't execute at all.

The next case is that plugin A returns PLUGIN_CONTINUE. In this case, plugin B's handler will be executed. If plugin B's handler now returns PLUGIN_CONTINUE as well, you will get the "command not found" message in your console. If it returns PLUGIN_HANDLED, there will be no such message.

BUT!!!!!!!!!! THERE'S ONE MORE CASE!!!!!!! Plugin A can return PLUGIN_HANDLED_MAIN. Then plugin B's handler gets called. However, no matter what plugin B's handler returns - the result of the "whole operation" will be PLUGIN_HANDLED (because plugin A said it would be) - which means that you won't get that "command not found" message thing.

IIRC it's a bit different with server commands, because with client commands, server plugins act like filters. ie. the engine says: DUDE, LOOK, A CLIENT COMMAND ARRIVED and then each plugin can say "Yup, I handled it, it's ok" or "Oh noes LOL!!!!! NOES!!! I don't want this command". AMXX, being one of the server plugins, has two ways of performing this filtering action: 1) register_clcmd, which we've just talked about and 2) the client_command forward function, which works just like metamod's ClientCommand forward. Okay, so what's the matter with server commands? Well, here, the engine does the filtering. That is, you say, "I register command gaben" and then the engine always knows that command gaben is registered by you, so it only calls your handler. You can't decide "I don't know this server command" once you've registered it (unlike with client commands). However, you can decide whether subsequent handlers of the same command will be executed by returning either PLUGIN_CONTINUE or PLUGIN_HANDLED. Note that I'm not completly sure about the server commands thing.
__________________
hello, i am pm
PM is offline
 



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:12.


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