AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Anti-Spam (https://forums.alliedmods.net/showthread.php?t=240305)

Bartu 05-12-2014 13:42

[Help] Anti-Spam
 
Hello, good afternoon.
First of all I notice that I'm from Argentina and I'm using the google translator. I need help with my next plugin I'm doing (recently started to make plugins), making my plugin is to block spam say_team and SAY, ​​what I need is to block spam by NAME and not how. This plugin did watching tutorials and codes using different anti-spam plugins.

Code:

#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "Anti-Spam"
#define VERSION "2.0"
#define AUTHOR "Bartu"
 
stock const advertising_words[][] = {
 
 "Spam 1",
 "Spam 2",
 "Spam 3"

}
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 register_clcmd("say", "hook_chat");
 register_clcmd("say_team", "hook_chat");
}
 
public hook_chat(id)
{
 if((get_user_flags(id) & ADMIN_KICK))
    return 0;
 new szArgs[512];
 read_args(szArgs, 511);
 
 new len;
 len = strlen(szArgs);
 
 new digits, periods;
 
 new szName[32];
 get_user_name(id, szName, 31);
 
 for(new i = 0 ; i < sizeof (advertising_words) ; i++)
 {
  if(containi(szArgs, advertising_words[i]) != -1)
  {
      client_cmd(0, "spk ^"barney/soundsbad^"")
      client_print(0, print_chat, "<<Anti-Spam>>")
      client_print(0, print_chat, "TAG: %s", szName)
      client_print(0, print_chat, "CASTIGO: Baneado Permanente")
            server_cmd("amx_ban %s 99999 Spamero Puto", szName)
  return 1;
  }
 }
 
 for(new i; i < len; i++)
 {
  if(isdigit(szArgs[i]))
  {
  digits++
  }
  else if(szArgs[i] == '.' || szArgs[i] == ':')
  {
  periods++
  }
 }
 
 if(digits > 3 && periods > 2)
 {
      client_cmd(0, "spk ^"barney/soundsbad^"")
      client_print(0, print_chat, "<<Anti-Spam>>")
      client_print(0, print_chat, "TAG: %s", szName)
      client_print(0, print_chat, "CASTIGO: Baneado Permanente")
            server_cmd("amx_ban %s 99999 Spamero Puto", szName)
  return 1;
 }
 return 0;
}



All times are GMT -4. The time now is 09:41.

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