Advertisement
Guest User

Untitled

a guest
Jan 14th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN  "BlockAds"
  5. #define AUTHOR  "Andrei."
  6. #define VERSION "1.0"
  7.  
  8. #pragma semicolon 1
  9.  
  10. new ads[][] =
  11. {
  12.     "wwwgooglecom"
  13. };
  14.  
  15. public plugin_init()
  16. {
  17.     register_plugin(PLUGIN, VERSION, AUTHOR);
  18.     register_clcmd("say", "hookSay");
  19. }
  20.  
  21. public hookSay(id)
  22. {
  23.     new text[192];
  24.    
  25.     read_args(text, 192);
  26.     remove_quotes(text);
  27.    
  28.     new alphaText[192];
  29.     new len = strlen(text);
  30.     new pos = 0;
  31.    
  32.     for (new i=0; i<len; ++i)
  33.     {
  34.         if (isalpha(text[i]))
  35.         {
  36.             alphaText[pos++] = text[i];
  37.         }
  38.     }
  39.    
  40.     new bool:isAd = false;
  41.    
  42.     for (new i=0; i<sizeof(ads); ++i)
  43.     {
  44.         if (containi(alphaText, ads[i]))
  45.         {
  46.             isAd = true;
  47.             break;
  48.         }
  49.     }
  50.    
  51.     return isAd? PLUGIN_HANDLED : PLUGIN_CONTINUE;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement