PHP Code:
#define TYPE 0
new Handle:cvarNDT;
public OnPluginStart()
{
RegConsoleCmd("say", chathook);
RegConsoleCmd("say_team", chathook);
cvarNDT = CreateConVar("noDeadTalk", "1", "If enabled, the players won't be allowed to chat when they are dead");
}
public Action:chathook(client, args)
{
if (client > 0)
{
if (GetConVarBool(cvarNDT))
{
if (!IsFakeClient(client) && GetClientTeam(client) > 1 && !IsPlayerAlive(client))
{
#if TYPE
decl String:display_message[192];
Format(display_message, 192, "\x04 %s", "You are not allowed to talk when you are dead!");
decl Handle:hBf;
hBf = StartMessageOne("SayText2", client);
if (hBf != INVALID_HANDLE)
{
BfWriteByte(hBf, 1);
BfWriteByte(hBf, 0);
BfWriteString(hBf, display_message);
EndMessage();
}
#endif
#if !TYPE
PrintToChat(client, "\x04 You are not allowed to talk when you are dead!");
#endif
return Plugin_Handled;
}
}
}
return Plugin_Continue;
}