Syntax: Select all
from Source import Player
from events.decorator import Event
from hooks import CallHook
@Event("player_activate")
def OnPlayerActivate(game_event):
# variable(list/tuple) = CallHook(<hookname>, <input variables>)
hook_args = CallHook("player_should_get_health", (Player.EdictOfUserid(game_event.GetInt('userid')), ))
if hook_args:
# do stuff
And then another script can do this:
Syntax: Select all
from hooks import Hook
# Works same way as Event method from events.decorator module.
@Hook("player_should_get_health")
def OnPlayerShouldGetHealth(player)
return (true, )
This way scripts can extend their functionality with hooks to change how it was gonna handle stuff.