Creating your own hooks

I’m wondering how I would go about adding my own hooks

so for example if I have a function called ChangeTeam( ply, team )

I would like to be able to do

hook.Add( “ChangeTeam”, “notify team members”, function() blah blah end )



Inside your ChangeTeam(ply, team) function add a line somewhat like:

hook.Call("ChangeTeam", GAMEMODE, ply, team)

And then you can use like

hook.Add("ChangeTeam", "PlayerChangedTeam", function(ply, team) /* do stuff */ end)