|
Senior Member
|
11-24-2019
, 12:46
Re: [REQ] Anti Chat Flood
|
#12
|
could u put it to use set_task for 30s like this one below:
Spoiler
#include <amxmodx>
//Uncomment the line bellow to avoid chat duplicates
//#define AVOID_DUPLICATES
#define SPAM_MAXCOUNT 3
#define BLOCK_DURATION 30
#define CHAT_DELAY 1.5
new Float:g_flChatDelay[33], bool:g_bMuted[33], g_iCount[33]
#if defined AVOID_DUPLICATES
new g_MsgSay
#endif
public plugin_init()
{
register_plugin("ANTI CHAT SPAMMER", "1.0", "ZinoZack47")
register_clcmd("say", "HookSay")
register_clcmd("say_team", "HookSay")
#if defined AVOID_DUPLICATES
g_MsgSay = get_user_msgid ("SayText")
register_message(g_MsgSay, "avoid_duplicated")
#endif
}
#if defined AVOID_DUPLICATES
public avoid_duplicated(MsgId, MsgDest, Receiver)
return PLUGIN_HANDLED
#endif
public HookSay(id)
{
if (g_bMuted[id])
return PLUGIN_HANDLED
static szMsg[192]
read_args(szMsg, charsmax(szMsg))
remove_quotes(szMsg)
if(!szMsg[0] || szMsg[0] == '/' || szMsg[0] == '@' || szMsg[0] == '!')
return PLUGIN_CONTINUE;
if (get_gametime() - g_flChatDelay[id] < CHAT_DELAY)
{
g_flChatDelay[id] = get_gametime()
g_iCount[id]++
if(g_iCount[id] > SPAM_MAXCOUNT)
{
client_print(id, print_center, "You have been muted for %d Seconds", BLOCK_DURATION)
g_bMuted[id] = true
set_task(float(BLOCK_DURATION), "UnmutePlayer", id)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public UnmutePlayer(id)
{
g_bMuted[id] = false
g_iCount[id] = 0
}
public client_disconnected(id)
{
g_bMuted[id] = false
g_iCount[id] = 0
g_flChatDelay[id] = 0.0
}
but this one doesn't work (it's just an example that what i want)
|
|
|
|