Hi,
I'd like to create a declaration for "listening" to a new GlobalForward, with a prototype return type of
void.
The
wiki page for Global Forwards has an example of creating a new forward with the prototype:
Code:
forward void OnClientDied(int attacker, int victim, const char[] weapon, bool headshot)
with the implementation:
Code:
new GlobalForward("OnClientDied", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Cell);
However, the ExecType parameter ET_Event would seem to imply a prototype with the return type of Action:
Quote:
ET_Event
Acts as an event with the Actions defined in core.inc, no mid-Stops allowed, returns highest
|
These pieces of information seem to be in conflict. For creating a prototype that returns void, shouldn't one instead create the new GlobalForward with the ExecType of ET_Ignore? Is the wiki incorrect here, or am I misunderstanding something about how GlobalForwards work? Can I safely declare a prototype that returns void despite ET_Event expecting to return Action?
I'm mainly asking this because I'd like to "subscribe" to a GlobalForward created by another plugin author using this exact pattern (probably copied from this wiki example snippet), and I'm unsure if I can just declare the forward prototype in my own code as public void, or do I have to use a public Action that returns Plugin_Continue because the GlobalForward's ExecType is ET_Event? I just want my plugin to have read access to the forward's parameters, not to block the call or modify the pushed values. It seems that the Plugin_Continue enum value is currently defined as 0, so perhaps returning void would result in the same behaviour, but I'm wondering if this kind of use would be well-defined.