register_event conditions
Hi,
I'm trying to fetch the weapons from kills using register_event on DeathMsg. Since I'm not interested in all weapons I thought I'd exclude those in the event condition. I tried this: PHP Code:
If i try it the other way round: PHP Code:
It seems with multiple conditions that ! is AND while = is OR. If I only use one condition ! works fine too (register_event("DeathMsg", "weaponcheck", "a", "4!usp") I could use the = comparison and list all weapons I'm trying to fetch (which is a lot) or filter the weapons in the called function, but that seems like a waste of resources Anyone know how to solve that? Thanks! |
Re: register_event conditions
Combining multiple not statements for the same parameter like that does not work. How this functions internally is that all conditions for a specific parameter are connected with or and all conditions for distinct parameters are connected with and.
In plugin pseudo-code it roughly works like this: Code:
Going even simpler, your first register_event basically causes this to happen internally: Code:
This will always be true, since parameter 4 will either not equal "usp" or not equal "elites" - it can't be both. The function will be executed for all weapons. The second version will result in logic equivalent to this: Code:
This will obviously trigger only if parameter 4 either equals "usp" or "elites" - exactly what you expect and what your tests show. Great question btw :) |
Re: register_event conditions
Thank you for your explanations!
I'm not sure about using two register_event calls with the same function though. Code:
register_event("DeathMsg", "weaponcheck", "a", "4!usp") |
Re: register_event conditions
Quote:
With some extra logic you could make it work, though. Not sure if you'd want that. |
Re: register_event conditions
I ended up doing it like this:
PHP Code:
Thanks again for your help |
| All times are GMT -4. The time now is 17:40. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.