MikuAuahDark)
Description 
NWH create a function that extends
addhook &
freehook function
Features 
No Conflicting Hooks
Use function address instead of string
On first add, it only need 1 hook only
Return 0 would cause the another code to called
Priority depending by ID(1 is the highest)
How to Install 
1. extract nwh.txt to desired folder(or just extract "sys" folder at cs2d folder and it will merged)
2. add to server.lua: dofile"sys/lua/nwh.txt"
3. save and done
Reserved Global Variables 
Hooks
AddHook(NOT
addhook)
FreeHook(NOT
freehook)
(All function name start from "temporary_<hook>")
Information 
Hooks: depending how many hooks used
Lines: 64
Size: 1787 Bytes
Importat Function: AddHook, FreeHook
Limitations 
Priority is set depending by ID(1 is highest)
ID of hook is separated(using "say" and then "sayteam" hook at same function would always return 1)
Functions 
NOTE: Function listen here is Case-Sensitive
AddHook(hook(string),func(string/function))
Parameters:
- hook, the hook name(list is here)
- func, function to executed when event occurs
Returns: ID of the hook(separated)(number)
On Error, it would return 0 and the string of the error
Example:1
HookID=AddHook("say",function(id,txt) print(id.." "..txt) end)
FreeHook(hook(string),id(number))
Parameters:
- hook, what hook to removed
- id, the separated ID of the hook
Returns: it's removed or not(boolean)
Example:1
print(tostring(FreeHook("say",HookID)))
Tip 
Return code on function is:
0 - Execute another function with same hook
1(or up) - Don't execute another functon until this event is triggered again
Rules 
You can use it for your server
You can edit it
You can upload at another website, say MikuAuahDark or
MikuAuahDark made it
You can't say this is yours
You can't upload on another website without put me on credits
Notes
1. When table containing the function list to executed is empty(for "this" hook), the hook would be free itself
2. I would recommended that this function is executed first at server.lua
Version History 
v1.0
edited 2×, last 18.07.13 10:43:17 pm
Approved by Seekay
Download
900 b, 554 Downloads
NWH(New Ways to Hook)
Offline
1 