A hook is function that is called whenever an event occurs in the engine. For example, a PlayerDeath hook would be called whenever a player dies.
[lua]local function PlayerDeath(ply)
print(ply:Nick() … “has died!”)
hook.Add(“PlayerDeath”, “Unique Name”, PlayerDeath)[/lua]
The first argument passed to hook.Add is the event that should trigger the function. A list of them can be found here.
The second argument is a unique identifier, this is so that you can have many hooks ‘hooked’ onto the same event. The unique identifier must be unique for the event, so you can have the same unique identifier as long as the event is different.
The third argument is the function to be called, this is called the callback. Any other arguments passed to hook.Add will be passed into the callback when it is triggered.