Advertisement
Guest User

Anti-Swear.

a guest
Jan 14th, 2015
1,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //------------------------------------------------------------------------------
  4.  
  5. #define MAX_ADVERTISMENTS 3
  6.  
  7. //------------------------------------------------------------------------------
  8.  
  9. new Warnings;
  10.  
  11. //------------------------------------------------------------------------------
  12.  
  13. new InvalidWords[][100] =
  14. {
  15. "idiot",
  16. "stupid",
  17. "fuck",
  18. "ass",
  19. "lick",
  20. "suck",
  21. "dick",
  22. "pussy",
  23. "cum",
  24. "sperm",
  25. "gay"
  26. };
  27.  
  28. //------------------------------------------------------------------------------
  29.  
  30. public OnPlayerSpawn(playerid)
  31. {
  32. SetTimerEx("Check", 2000, false, "i", playerid);
  33. return 1;
  34. }
  35.  
  36. //------------------------------------------------------------------------------
  37.  
  38. public OnPlayerText(playerid, text[])
  39. {
  40. new string[128];
  41. for(new cnt = 0; cnt < sizeof(InvalidWords); cnt++)
  42. {
  43. if(strfind(text, InvalidWords[cnt], true) != -1)
  44. {
  45. Warnings++;
  46. format(string, sizeof(string), "{FF0000}[WARNING]: {FFFFFF}Invalid Word has been detected. {FF0000}WARNINGS: {15FF00}[%d/%d]", Warnings, MAX_ADVERTISMENTS);
  47. SendClientMessage(playerid, -1, string);
  48. return 0;
  49. }
  50. }
  51. return 1;
  52. }
  53.  
  54. //------------------------------------------------------------------------------
  55.  
  56. forward Check(playerid);
  57.  
  58. //------------------------------------------------------------------------------
  59.  
  60. public Check(playerid)
  61. {
  62. new string[128], name[MAX_PLAYER_NAME];
  63. GetPlayerName(playerid, name, sizeof(name));
  64. if(Warnings == MAX_ADVERTISMENTS)
  65. {
  66. format(string, sizeof(string), "{FF0000}[INFO]: {FFFFFF}Player {FF0000}%s {FFFFFF}has been kicked for using {FF0000}Invalid Words.", name);
  67. SendClientMessageToAll(-1, string);
  68. Kick(playerid);
  69. }
  70. return 1;
  71. }
  72.  
  73. //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement