Block event/forward default procedure
Hello!
I've got another feature that I want to work on which blocks the player from switching teams, in a way that doesn't revert him to his old team, rather not switching him teams in the first place. I found that in DoD, "PTeam" is an event that is called when the player tries to switch teams. Is there a way to overwrite / block the default procedure of the event? So that a custom function that is registered on the event will block the team switch from happening? PHP Code:
Because I've noticed that there are return types such as PLUGIN_HANDLED, PLUGIN_CONTINUE but I can't seem to get them to work. (At least with my past attempts) Though I feel like my problem could be solved with those returns values in someway |
Re: Block event/forward default procedure
Its not possible to block events because its already been happened.
|
Re: Block event/forward default procedure
Quote:
(I'm just not able to check it right now though curious) |
Re: Block event/forward default procedure
if its a global forward i don't see a problem but i am not that familiar with the DoD mod so i won't give tips, give a test and you will know!
|
Re: Block event/forward default procedure
You can use register_message to hook events as pre and block. Fakemeta/hamsandwich hooks can be blocked when hooked as pre.
However, blocking something does not guarantee things will work as you expect them to. For example, blocking DeathMsg event hooked as a message won't prevent the player from being killed as DeathMsg is merely a notification. |
Re: Block event/forward default procedure
I think you'd be better off trying to block the jointeam command sent from the client rather than trying to block some random thing that has "team" in the name since there is a high likelihood that you'll mess with some larger more complex operation.
EDIT: I just tested registering "jointeam" with register_clcmd() and then returning PLUGIN_HANDLED if I want to block joining teams and PLUGIN_CONTINUE if I don't want to block it. I used a global variable to control which return value was used and toggles that value with a chat command for testing. |
| All times are GMT -4. The time now is 11:36. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.