This module exposes a forwards system to its own plug-ins. The system is separate from the forwards system in SourceMod – that is, you can’t create a forward in Viper and have it call SourcePawn functions.
| Exec Type | Description |
|
Ignore all return values and return None |
|
This is no longer used and will act like ET_Ignore |
|
Acts as an event, allowing callbacks to return Plugin result types. Mid-stops are not allowed, meaning returning Plugin_Stop will not stop the forward. Returns the highest number value returned. |
|
Acts as a hook, allowing callbacks to return Plugin result types. Mid-stops are allowed, meaning returning Plugin_Stop will stop the forward. Returns the highest number value returned. |
|
Same as ET_Event, except that it returns the lowest number value returned. |
Creates a new forward. All the arguments after et should be the types of the objects that will be passed to the forward’s hooks. For example:
>>> myforward = create("", None, ET_Ignore, int, int, str)
<anonymous Forward: 0x819c12d>
>>> def myhook(num1, num2, name):
... print num1, num2, name
... return Plugin_Continue
...
>>> myforward.add_function(myhook)
>>> myforward.fire(3, 1337, "elite")
3 1337 elite
To reduce ambiguity, the callbacks that are called when myforward.fire() is run (added by myforward.add_function()) are called hooks or registered callbacks.
Note
Pass a blank forward name to create an anonymous forward.
| Parameters: |
|
|---|---|
| Returns: |
Registers a callback for the global forward specified in forward.
| Returns: | True if successful; False if the specified forward could not be found or if the forward name passed is blank. |
|---|
Calling len() on a forward will return the number of hooks registered to the forward. Also, you can use myforward[x] to retrieve the registered callback at index x, and use the in syntax: if myhook in myforward