chat hook logic in scripts.dll 2.1.2 [message #153511] |
Sun, 08 May 2005 10:41 |
|
Cat998
Messages: 1082 Registered: January 2004 Location: Austria, Vienna
Karma:
|
General (1 Star) Moderator/Captain |
|
|
I know there is any1 that knows howto
bhs.txt :
Quote: |
There is also a hook that lets custom scripts.dll mods (e.g. server-side mods) get access to all f2/f3 chat that passes through the server.
You create a function of the form
void Chat_Hook(int PlayerID,int Type,const char *Message)
Then you pass the function to AddChatHook (defined in engine.h)
Then, the function gets called everytime f2/f3 chat passes through the server.
PlayerID is the player ID of the player that sent the chat.
Type is 1 for team mesasge and 0 for everyone message.
Message is the message itself. If you need to save the message data for later use, copy the string, dont save the pointer passed into your chat
hook function, copy the data somewhere else.
You can only have one chat hook function registered at any one time. Also, if you want to have no chat hook at all registered, pass NULL to AddChatHook.
This works on the server regardless of if clients have bhs.dll
This functionality is quite useful if you want to make new !xxx commands, especially since you can use the player ID to verify that the person using the command
is authorized to use it. It also means you can do all the things that you would otherwise need new console commands to do.
|
When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"
Programming is like sex: one mistake and you have to support it for the rest of your life
Want the best answers? Ask the best questions!
"So long, and thanks for all the fish."
|
|
|