AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to hook chat (https://forums.alliedmods.net/showthread.php?t=47367)

Rolnaaba 11-16-2006 10:19

how to hook chat
 
How cna I hook when people say something in chat and get the message and who said it?

P34nut 11-16-2006 10:22

Re: how to hook chat
 
Code:

register_clcmd("say", "fnSay")
OR
try SayText event

[ --<-@ ] Black Rose 11-16-2006 10:25

Re: how to hook chat
 
Code:
#include <amxmodx> public plugin_init() {     register_plugin("", "", "")         register_clcmd("say", "handle_say")     register_clcmd("say_team", "handle_say") } public handle_say(id) {         new args[128]     read_args(args, 127)         remove_quotes(args)     //... }

VEN 11-16-2006 11:19

Re: how to hook chat
 
Quote:

OR
try TextMsg event
It's actually SayText, not TextMsg

P34nut 11-16-2006 11:31

Re: how to hook chat
 
oops yeah your right.. fixed in my post to

Rolnaaba 11-16-2006 12:48

Re: how to hook chat
 
wow sry I feel stupid :(

[EDIT] this is info from wiki:
Quote:

Prints say HUD text. Second parameter can be a predefined string or a custom one. In the last case the last two parameters isn't required.
Some values of the predifined string: #Cstrike_Chat_AllDead, #Cstrike_Chat_All
Name: SayText
Structure:
byte: SenderID
string: String
string: unknown
string: Text
so would this work?
Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("SayText", "hook_say") } public hook_say() {     new talker = read_data(1)     new message = read_data(4)         if(equali(message, "blah")) {         return Rolnaaba_RULES             } }
and if their message is blah case insensative would return I rule?

[ --<-@ ] Black Rose 11-16-2006 14:52

Re: how to hook chat
 
Code:
public plugin_init() {     register_plugin("", "", "")     register_event("SayText", "hook_say") } public hook_say() {     new talker = read_data(1)     new message[128]     read_data(4, message, 127)         if ( equali(message, "blah") )         return Rolnaaba_RULES }

Rolnaaba 11-16-2006 17:30

Re: how to hook chat
 
ty


All times are GMT -4. The time now is 06:48.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.