The Source Engine defines events that are fired when certain things happen. For example, the event player_shoot is fired when a player fires their weapon in Counter-Strike: Source.
| Event Hook Mode | Description |
|
Hook callback fired before the event is fired. |
|
Hook callback fired after the event is fired. |
|
Hook callback fired after event is fired, but event data is not copied. |
Creates a game event. If force is True, it forces the event to be created even if it’s not being hooked. Note that this will not force the event to be created if the event doesn’t exist at all.
Returns an Event object that represents the game event created, or None if the event does not exist.
Hooks a game event. This raises a ViperError if the game event does not exist. mode expects an EventHookMode constant.
callback should be a callable that accepts two arguments: an event object, and the event name as a string – in that order.
Note
There is no way to determine what fields are available in a game event, or the type of a field, which is why this class contains so many inconvenient methods.
Retrieves a value from a game event.
Note
These will ALWAYS return a value, even if the field does not exist. Use has_field to make sure the field exists.