Thread: fix a plugin
View Single Post
Author Message
Mankled
Senior Member
Join Date: Oct 2019
Old 11-27-2019 , 01:24   fix a plugin
Reply With Quote #1

can someone fix this plugin, cus isn't working

PHP Code:
#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(MsgIdMsgDestReceiver)
return 
PLUGIN_HANDLED
#endif

public HookSay(id)
{
if (
g_bMuted[id])
return 
PLUGIN_HANDLED

static szMsg[192]
read_args(szMsgcharsmax(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(idprint_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

Mankled is offline