Advertisement
Guest User

CensorShip

a guest
Oct 15th, 2012
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.23 KB | None | 0 0
  1. //-------------------------------------------------------------------------//
  2. /*
  3.       _______  _______  _        _______  _______  _______
  4.     (  ____ \(  ____ \( (    /|(  ____ \(  ___  )(  ____ )
  5.     | (    \/| (    \/|  \  ( || (    \/| (   ) || (    )|
  6.     | |      | (__    |   \ | || (_____ | |   | || (____)|
  7.     | |      |  __)   | (\ \) |(_____  )| |   | ||     __)
  8.     | |      | (      | | \   |      ) || |   | || (\ (
  9.     | (____/\| (____/\| )  \  |/\____) || (___) || ) \ \__
  10.     (_______/(_______/|/    )_)\_______)(_______)|/   \__/
  11.                 by AzkarGames/SolidZone (The same guy, but 2 different names)
  12.                
  13.                 Terms of use:
  14.                 You may edit this filterscript and publish it again,
  15.                 but you should at least keep the original credits in here.
  16.                 In case you delete the credits, the punishment would be
  17.                 bad conscience.
  18.                
  19.                 This isn't the final version, so bugs may appear.
  20.                 I'm trying to update this system as often as I change it.
  21. */
  22. //-------------------------------------------------------------------------//
  23.  
  24. #include <a_samp>
  25. #define COLOR_CENSOR 0xFFFF00FF
  26.  
  27. new ins_words[][] =
  28. {
  29.     "whore","sucker","fucker","wixxer","wanker","fuck","suck","dickhead","cock",
  30.     "bitch","schlampe","nutte","arschloch","hurensohn","cunt","fotze","schwanzkopf",
  31.     "jizz","missgeburt","mistgeburt","scheisse","scheiße","scheisshaufen","scheißhaufen",
  32.     "analritter","schwuchtel","fag"
  33. };
  34.  
  35. public OnFilterScriptInit()
  36. {
  37.     print("\n-----------------------------------------------");
  38.     print("Censorship-Filterscript by SolidZone/AzkarGames");
  39.     print("-----------------------------------------------\n");
  40.     return 1;
  41. }
  42. public OnFilterScriptExit()
  43. {
  44.     return 1;
  45. }
  46. public OnPlayerText(playerid, text[])
  47. {
  48.     new ret = true;
  49.     new rsrwords = 0;
  50.     new idx;
  51.     while(rsrwords < strlnmb(text,' ') + 1)
  52.     {
  53.         if(insult(strtok(text,idx)))
  54.         {
  55.             SendClientMessage(playerid,COLOR_CENSOR,"[CS-System]: You shouldn't say that to someone!");
  56.             ret = false;
  57.         }
  58.         rsrwords++;
  59.     }
  60.     return ret;
  61. }
  62. stock insult(string[])
  63. {
  64.     new rins = false;
  65.     for(new i = 0; i < sizeof(ins_words);i++)
  66.     {
  67.         if(strfind(string,ins_words[i],true) != -1)
  68.         {
  69.             new nmblbins = strfind(string,ins_words[i],true);
  70.             new offs = nmblbins + strlen(ins_words[i]);
  71.             new lbins[20];
  72.             strmid(lbins,string,0,nmblbins);
  73.             new lains[20];
  74.             strmid(lains,string,offs,strlen(string));
  75.             new nmblains = strlen(lains);
  76.             if(nmblbins < 3 && nmblains < 3)
  77.             {
  78.                 rins = true;
  79.                 break;
  80.             }
  81.             if(strlnmb(lains,ins_words[i][strlen(ins_words[i])]) > 1 || strlnmb(lbins,ins_words[i][0]) > 1)
  82.             {
  83.                 rins = true;
  84.                 break;
  85.             }
  86.         }
  87.     }
  88.     return rins;
  89. }
  90. stock strlnmb(string[],letter)
  91. {
  92.     new length = strlen(string);
  93.     new foundletter;
  94.     for(new i = 0; i < length; i++)
  95.     {
  96.         if(string[i] == letter) foundletter++;
  97.     }
  98.     return foundletter;
  99. }
  100. strtok(const string[], &index)
  101. {
  102.     new length = strlen(string);
  103.     while ((index < length) && (string[index] <= ' '))
  104.     {
  105.         index++;
  106.     }
  107.  
  108.     new offset = index;
  109.     new result[30];
  110.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  111.     {
  112.         result[index - offset] = string[index];
  113.         index++;
  114.     }
  115.     result[index - offset] = EOS;
  116.     return result;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement