Raised This Month: $51 Target: $400
 12% 

Get Player Chat Event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostdlr
Senior Member
Join Date: Aug 2010
Old 12-14-2022 , 12:43   Get Player Chat Event
Reply With Quote #1

What event can I use to get what players type in chat?

Team Chat, All Chat, Spectator Chat
ghostdlr is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-14-2022 , 21:36   Re: Get Player Chat Event
Reply With Quote #2

The simplest and most used method is to register the client command "say" and "say_team":

PHP Code:
public plugin_init()
{
    
register_clcmd("say","cmdSay");
    
register_clcmd("say_team","cmdSayTeam");
}

public 
cmdSay(id)
{
    new 
szSaid[64]
    
read_args(szSaidcharsmax(szSaid))
    
trim(szSaid)
    
// szSaid contains the string that the player said in "all chat"
}

public 
cmdSayTeam(id)
{
    new 
szSaid[64]
    
read_args(szSaidcharsmax(szSaid))
    
trim(szSaid)
    
// szSaid contains the string that the player said in "team chat"

If you're in spectate, these same commands are triggered so you'll need to check their team to determine if they are in spectate.
__________________

Last edited by fysiks; 12-14-2022 at 21:43.
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:38.


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