#include <sourcemod>
#include <regex>
public Plugin:myinfo =
{
name = "ipblocker",
author = "ExoIT",
description = "",
version = "1.0.0",
url = "http://..."
};
new Handle:h_Pattern = INVALID_HANDLE;
new bool:warnings[MAXPLAYERS+1];
public OnPluginStart()
{
RegConsoleCmd("say", SayCallBack);
RegConsoleCmd("say_team", SayCallBack);
h_Pattern = CompileRegex("([0-9]{1,3})[.|,]([0-9]{1,3})[.|,]([0-9]{1,3})[.|,]([0-9]{1,3})[:]?([0-9]{1,5})?");
}
public Action:SayCallBack(client, args)
{
decl String:message[128];
GetCmdArgString(message, sizeof(message));
TrimString(message);
ReplaceString(message, sizeof(message), " ", "");
if(MatchRegex(h_Pattern, message) > 0)
{
if(warnings[client])
BanClient(client, 3600, BANFLAG_AUTHID, "Реклама", "Вы были забанены за рекламу");
warnings[client] = true;
PrintToChat(client, "[SM] На сервере реклама запрещена! (последнее предупреждение)");
return Plugin_Handled;
}
return Plugin_Continue;
}
public OnClientDisconnect_Post(client)
{
warnings[client] = false;
}