AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get Player Chat Event (https://forums.alliedmods.net/showthread.php?t=340852)

ghostdlr 12-14-2022 12:43

Get Player Chat Event
 
What event can I use to get what players type in chat?

Team Chat, All Chat, Spectator Chat

fysiks 12-14-2022 21:36

Re: Get Player Chat Event
 
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.


All times are GMT -4. The time now is 15:37.

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