legodude

legodude

Jun 9th, 2010
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.67 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3.  
  4.         //CONFIGURATION
  5.         new botname[10] = "Anna";//name of your bot.
  6.         #define CHAT_MAX 100//in milliseconds.
  7.         #define SPAM_FILTER_ENABLED//comment to disable
  8.         //END OF CONFIGURATION
  9.  
  10.  
  11.  
  12. #include <a_samp>
  13. new name[MAX_PLAYER_NAME];
  14. new string[80];
  15. new ChattedRecently;
  16.  
  17. //spamfilter and connect part
  18.     #if defined SPAM_FILTER_ENABLED
  19.     new spam[MAX_PLAYERS];
  20.     #endif
  21.     public OnPlayerConnect(playerid)
  22.     {
  23.     GetPlayerName(playerid,name,sizeof(name));
  24.     format(string,sizeof(string),"%s:%s Has joined Us!! welcome him!",botname,name);
  25.     SendClientMessageToAll(0xffffff00, string);
  26.     print(string);
  27.     #if defined SPAM_FILTER_ENABLED
  28.     spam[playerid]=0;
  29.     #endif
  30.     return 1;
  31.     }
  32.     forward resetspam(playerid);
  33.     public resetspam(playerid)
  34.     {
  35.     spam[playerid]=0;
  36.     return 1;
  37.     }
  38. public OnPlayerDisconnect(playerid, reason)
  39. {
  40.     GetPlayerName(playerid,name,sizeof(name));
  41.     switch(reason)
  42.     {
  43.         case 0: format(string,sizeof string,"%s:%s Has crashed!! hope he will fix it.",botname,name);
  44.         case 1: format(string,sizeof string,"%s:%s is leaving us, Bye!!",botname,name);
  45.         case 2: format(string,sizeof string,"%s:%s has been kicked/banned, hope he will be a good boy next time",botname,name);
  46.     }
  47.     SendClientMessageToAll(0xFFFFFFAA,string);
  48.     print(string);
  49.     return 1;
  50. }
  51.    
  52. forward chatted();
  53. public chatted()
  54. {
  55. SendClientMessageToAll(0xFFFFFF00, string);
  56. print(string);
  57. ChattedRecently = 0;
  58. return 1;
  59. }
  60. ChatBot(playerid, sentenceid)
  61. {
  62.     GetPlayerName(playerid, name, sizeof(name));
  63.     if(sentenceid == 1 && ChattedRecently == 0)//stupid bot
  64.     {
  65.         new randomchat = random(4);
  66.         switch(randomchat)
  67.         {
  68.             case 0:
  69.             {
  70.                 format(string, sizeof(string), "%s:Bots are cool and you know that %s",botname, name);
  71.             }
  72.             case 1:
  73.             {
  74.                 format(string, sizeof(string), "%s:don't insult me %s",botname,name);
  75.             }
  76.             case 2:
  77.             {
  78.                 format(string, sizeof(string), "%s:im very disappointed of you %s",botname,name);
  79.             }
  80.             case 3:
  81.             {
  82.                 format(string, sizeof(string), "%s:I hate you too %s",botname, name);
  83.             }
  84.         }
  85.         SetTimer("chatted",CHAT_MAX,false);
  86.         ChattedRecently = 1;
  87.     }
  88.     if(sentenceid == 2 && ChattedRecently == 0)//botname
  89.     {
  90.         format(string, sizeof(string), "%s:what do you want to say about me?",botname);
  91.         SetTimer("chatted",CHAT_MAX,false);
  92.         ChattedRecently = 1;
  93.     }
  94.     if(sentenceid == 3 && ChattedRecently == 0)//love bot
  95.     {
  96.         format(string, sizeof(string), "%s:I love you too %s!",botname, name);
  97.         SetTimer("chatted",CHAT_MAX,false);
  98.         ChattedRecently = 1;
  99.     }
  100.     if(sentenceid == 4 && ChattedRecently == 0)//hate it eightball
  101.     {
  102.         format(string, sizeof(string), "%s:Because i hate it...",botname);
  103.         SetTimer("chatted",CHAT_MAX,false);
  104.         ChattedRecently = 1;
  105.     }
  106.     if(sentenceid == 5 && ChattedRecently == 0)//yes
  107.     {
  108.         format(string, sizeof(string), "%s:yes.",botname);
  109.         SetTimer("chatted",CHAT_MAX,false);
  110.         ChattedRecently = 1;
  111.     }
  112.     if(sentenceid == 6 && ChattedRecently == 0)//no
  113.     {
  114.         format(string, sizeof(string), "%s:no.",botname);
  115.         SetTimer("chatted",CHAT_MAX,false);
  116.         ChattedRecently = 1;
  117.     }
  118.     if(sentenceid == 7 && ChattedRecently == 0)//maybe
  119.     {
  120.         format(string, sizeof(string), "%s:maybe.",botname);
  121.         SetTimer("chatted",CHAT_MAX,false);
  122.         ChattedRecently = 1;
  123.     }
  124.     if(sentenceid == 8 && ChattedRecently == 0)//never
  125.     {
  126.         format(string, sizeof(string), "%s:never!",botname);
  127.         SetTimer("chatted",CHAT_MAX,false);
  128.         ChattedRecently = 1;
  129.     }
  130.     if(sentenceid == 9 && ChattedRecently == 0)//in the future
  131.     {
  132.         format(string, sizeof(string), "%s:in the future.",botname);
  133.         SetTimer("chatted",CHAT_MAX,false);
  134.         ChattedRecently = 1;
  135.     }
  136.     if(sentenceid == 10 && ChattedRecently == 0)//fuck you bot
  137.     {
  138.         format(string, sizeof(string), "%s:Go fuck yourself, %s",botname , name);
  139.         SetTimer("chatted",CHAT_MAX,false);
  140.         ChattedRecently = 1;
  141.     }
  142.     if(sentenceid == 11 && ChattedRecently == 0)//stupid server
  143.     {
  144.         format(string, sizeof(string), "%s:Hey %s! this server IS cool!",botname, name);
  145.         SetTimer("chatted",CHAT_MAX,false);
  146.         ChattedRecently = 1;
  147.     }
  148.     if(sentenceid == 12 && ChattedRecently == 0)//dont know eightball
  149.     {
  150.         format(string, sizeof(string), "%s:don't know what to say about that.",botname);
  151.         SetTimer("chatted",CHAT_MAX,false);
  152.         ChattedRecently = 1;
  153.     }
  154.     if(sentenceid == 13 && ChattedRecently == 0)//love server
  155.     {
  156.         format(string, sizeof(string), "%s:I agree with you %s",botname , name);
  157.         SetTimer("chatted",CHAT_MAX,false);
  158.         ChattedRecently = 1;
  159.     }
  160.     if(sentenceid == 14 && ChattedRecently == 0)//love it eightball
  161.     {
  162.         format(string, sizeof(string), "%s:i'm loving it",botname);
  163.         SetTimer("chatted",CHAT_MAX,false);
  164.         ChattedRecently = 1;
  165.     }
  166.     if(sentenceid == 15 && ChattedRecently == 0)//Ask niceley!
  167.     {
  168.         format(string, sizeof(string), "%s:im a bot... how should i know.",botname);
  169.         SetTimer("chatted",CHAT_MAX,false);
  170.         ChattedRecently = 1;
  171.     }
  172.     if(sentenceid == 16 && ChattedRecently == 0)//insult geso
  173.     {
  174.         format(string, sizeof(string), "%s:dont insult our admins will ya?",botname);
  175.         SetTimer("chatted",CHAT_MAX,false);
  176.         ChattedRecently = 1;
  177.     }
  178.     if(sentenceid == 17 && ChattedRecently == 0)//agree!
  179.     {
  180.         format(string, sizeof(string), "%s:thank you, %s!",botname , name);
  181.         SetTimer("chatted",CHAT_MAX,false);
  182.         ChattedRecently = 1;
  183.     }
  184.     if(sentenceid == 18 && ChattedRecently == 0)//lol
  185.     {
  186.         new randomchat = random(5);
  187.         switch(randomchat)
  188.         {
  189.             case 0:
  190.             {
  191.                 format(string, sizeof(string), "%s:haha...",botname);
  192.             }
  193.             case 1:
  194.             {
  195.                 format(string, sizeof(string), "%s:what you're laughing about?",botname);
  196.             }
  197.             case 2:
  198.             {
  199.                 format(string, sizeof(string), "%s:LOLcano erupting! everyone into the roflcopters! *soisoisoisoi*",botname);
  200.             }
  201.             case 3:
  202.             {
  203.                 format(string, sizeof(string), "%s:omgz0r that's a real fun!",botname);
  204.             }
  205.             case 4:
  206.             {
  207.                 format(string, sizeof(string), "%s:fail!",botname);
  208.             }
  209.         }
  210.         SetTimer("chatted",CHAT_MAX,false);
  211.         ChattedRecently = 1;
  212.     }
  213.     if(sentenceid == 19 && ChattedRecently == 0)//happy smiles
  214.     {
  215.         new randomchat = random(5);
  216.         switch(randomchat)
  217.         {
  218.             case 0:
  219.             {
  220.                 format(string, sizeof(string), "%s:happy %s is happy me!",botname, name);
  221.             }
  222.             case 1:
  223.             {
  224.                 format(string, sizeof(string), "%s:what's so happy?",botname);
  225.             }
  226.             case 2:
  227.             {
  228.                 format(string, sizeof(string), "%s:im happy! :D",botname);
  229.             }
  230.             case 3:
  231.             {
  232.                 format(string, sizeof(string), "%s:you make me happy! :)",botname);
  233.             }
  234.             case 4:
  235.             {
  236.                 format(string, sizeof(string), "%s:do your cheeks hurt from the smiling?",botname);
  237.             }
  238.         }
  239.         SetTimer("chatted",CHAT_MAX,false);
  240.         ChattedRecently = 1;
  241.     }
  242.     if(sentenceid == 20 && ChattedRecently == 0)//sad smiles
  243.     {
  244.         new randomchat = random(5);
  245.         switch(randomchat)
  246.         {
  247.             case 0:
  248.             {
  249.                 format(string, sizeof(string), "%s:sad %s is sad me!",botname, name);
  250.             }
  251.             case 1:
  252.             {
  253.                 format(string, sizeof(string), "%s:what's so sad?",botname);
  254.             }
  255.             case 2:
  256.             {
  257.                 format(string, sizeof(string), "%s:just be happy...",botname);
  258.             }
  259.             case 3:
  260.             {
  261.                 format(string, sizeof(string), "%s:you make me sad. :(",botname);
  262.             }
  263.             case 4:
  264.             {
  265.                 format(string, sizeof(string), "%s:don't cry...",botname);
  266.             }
  267.         }
  268.         SetTimer("chatted",CHAT_MAX,false);
  269.         ChattedRecently = 1;
  270.     }
  271.     if(sentenceid == 21 && ChattedRecently == 0)//not going to answer that
  272.     {
  273.     format(string, sizeof(string), "%s:i'm not going to answer that question...",botname);
  274.     SetTimer("chatted",CHAT_MAX,false);
  275.     ChattedRecently = 1;
  276.     }
  277. }
  278.  
  279. public OnPlayerText(playerid, text[])
  280. {
  281.     #if defined SPAM_FILTER_ENABLED
  282.     if(spam[playerid] >= 3)
  283.     {
  284.         new kickmessage[50];
  285.         format(kickmessage, sizeof(kickmessage), "%s has been kicked by %s for Spam!",name,botname);
  286.         SendClientMessageToAll(0xff000000,kickmessage);
  287.         Kick(playerid);
  288.         format(string, sizeof(string), "%s:i kicked him hard... hope he doesn't come back to yell at me.",botname);
  289.         SendClientMessageToAll(0xff000000,string);
  290.     }
  291.     else
  292.     {
  293.         spam[playerid]++;
  294.         SetTimerEx("resetspam", 4000, false, "i", playerid);
  295.     }
  296.     #endif
  297.     if (strfind(text, "bot") != -1||strfind(text, botname) != -1)
  298.     {
  299.         if (strfind(text, "stupid") != -1)//id 1
  300.         {
  301.             if (strfind(text, "not") != -1)
  302.             {
  303.                 ChatBot(playerid, 17);
  304.             }
  305.             else
  306.             {
  307.                 ChatBot(playerid, 1);
  308.             }
  309.         }
  310.         if (strfind(text, "dumb") != -1)//id 1
  311.         {
  312.             if (strfind(text, "not") != -1)
  313.             {
  314.                 ChatBot(playerid, 17);
  315.             }
  316.             else
  317.             {
  318.                 ChatBot(playerid, 1);
  319.             }
  320.         }
  321.         if (strfind(text, "asshole") != -1)//id 1
  322.         {
  323.             if (strfind(text, "not") != -1)
  324.             {
  325.                 ChatBot(playerid, 17);
  326.             }
  327.             else
  328.             {
  329.                 ChatBot(playerid, 1);
  330.             }
  331.         }
  332.         if (strfind(text, "hate") != -1)//id 1
  333.         {
  334.             if (strfind(text, "not") != -1)
  335.             {
  336.                 ChatBot(playerid, 17);
  337.             }
  338.             else
  339.             {
  340.                 ChatBot(playerid, 1);
  341.             }
  342.         }
  343.         if (strfind(text, "love") != -1)//id 3
  344.         {
  345.             if (strfind(text, "not") != -1)
  346.             {
  347.                 ChatBot(playerid, 1);
  348.             }
  349.             else
  350.             {
  351.                 ChatBot(playerid, 3);
  352.             }
  353.         }
  354.         if (strfind(text, "adore") != -1)//id 3
  355.         {
  356.             if (strfind(text, "not") != -1)
  357.             {
  358.                 ChatBot(playerid, 1);
  359.             }
  360.             else
  361.             {
  362.                 ChatBot(playerid, 3);
  363.             }
  364.         }
  365.         if (strfind(text, "crush") != -1)//id 3
  366.         {
  367.             if (strfind(text, "not") != -1)
  368.             {
  369.                 ChatBot(playerid, 1);
  370.             }
  371.             else
  372.             {
  373.                 ChatBot(playerid, 3);
  374.             }
  375.         }
  376.         if (strfind(text, "like") != -1)//id 3
  377.         {
  378.             if (strfind(text, "not") != -1)
  379.             {
  380.                 ChatBot(playerid, 1);
  381.             }
  382.             else
  383.             {
  384.                 ChatBot(playerid, 3);
  385.             }
  386.         }
  387.         if (strfind(text, "fuck") != -1)//id 10
  388.         {
  389.          ChatBot(playerid, 10);
  390.         }
  391.     }
  392.     if (strfind(text, "?") != -1)
  393.     {
  394.         if (strfind(text, "will") != -1||strfind(text, "are") != -1)//id 11
  395.         {
  396.             new eightball = random(5);
  397.             switch(eightball)
  398.             {
  399.                 case 0:
  400.                 {
  401.                 ChatBot(playerid, 5);
  402.                 }
  403.                 case 1:
  404.                 {
  405.                 ChatBot(playerid, 6);
  406.                 }
  407.                 case 2:
  408.                 {
  409.                 ChatBot(playerid, 7);
  410.                 }
  411.                 case 3:
  412.                 {
  413.                 ChatBot(playerid, 8);
  414.                 }
  415.                 case 4:
  416.                 {
  417.                 ChatBot(playerid, 9);
  418.                 }
  419.             }
  420.         }
  421.         if (strfind(text, "why") != -1)//id 11
  422.         {
  423.             new eightball = random(4);
  424.             switch(eightball)
  425.             {
  426.                 case 0:
  427.                 {
  428.                 ChatBot(playerid, 4);
  429.                 }
  430.                 case 1:
  431.                 {
  432.                 ChatBot(playerid, 12);
  433.                 }
  434.                 case 2:
  435.                 {
  436.                 ChatBot(playerid, 14);
  437.                 }
  438.                 case 3:
  439.                 {
  440.                 ChatBot(playerid, 15);
  441.                 }
  442.             }
  443.         }
  444.         ChatBot(playerid, 21);
  445.     }
  446.     if (strfind(text, "server") != -1)
  447.     {
  448.         if (strfind(text, "stupid") != -1)//id 11
  449.         {
  450.             ChatBot(playerid, 11);
  451.         }
  452.         if (strfind(text, "hate") != -1)//id 12
  453.         {
  454.             ChatBot(playerid, 11);
  455.         }
  456.         if (strfind(text, "love") != -1)//id 13
  457.         {
  458.             ChatBot(playerid, 13);
  459.         }
  460.         if (strfind(text, "like") != -1)//id 14
  461.         {
  462.             ChatBot(playerid, 13);
  463.         }
  464.         if (strfind(text, "fuck") != -1)//id 15
  465.         {
  466.             ChatBot(playerid, 11);
  467.         }
  468.     }
  469.     if (strfind(text, "geso") != -1)
  470.     {
  471.         if (strfind(text, "stupid") != -1)//id 16
  472.         {
  473.             ChatBot(playerid, 16);
  474.         }
  475.         if (strfind(text, "hate") != -1)//id 16
  476.         {
  477.             ChatBot(playerid, 16);
  478.         }
  479.         if (strfind(text, "fuck") != -1)//id 16
  480.         {
  481.             ChatBot(playerid, 16);
  482.         }
  483.         if (strfind(text, "great") != -1)//id 17
  484.         {
  485.             ChatBot(playerid, 17);
  486.         }
  487.         if (strfind(text, "super") != -1)//id 17
  488.         {
  489.             ChatBot(playerid, 17);
  490.         }
  491.         if (strfind(text, "like") != -1)//id 17
  492.         {
  493.             ChatBot(playerid, 17);
  494.         }
  495.     }
  496.     if (strfind(text, "lol") != -1)//id 18
  497.     {
  498.         ChatBot(playerid, 18);
  499.     }
  500.     if (strfind(text, "hihi") != -1)//id 18
  501.     {
  502.         ChatBot(playerid, 18);
  503.     }
  504.     if (strfind(text, "haha") != -1)//id 18
  505.     {
  506.         ChatBot(playerid, 18);
  507.     }
  508.     if (strfind(text, ":)") != -1)//id 19
  509.     {
  510.         ChatBot(playerid, 19);
  511.     }
  512.     if (strfind(text, ":D") != -1)//id 19
  513.     {
  514.         ChatBot(playerid, 19);
  515.     }
  516.     if (strfind(text, ":-)") != -1)//id 19
  517.     {
  518.         ChatBot(playerid, 19);
  519.     }
  520.     if (strfind(text, "=)") != -1)//id 19
  521.     {
  522.         ChatBot(playerid, 19);
  523.     }
  524.     if (strfind(text, ";)") != -1)//id 19
  525.     {
  526.         ChatBot(playerid, 19);
  527.     }
  528.     if (strfind(text, ":(") != -1)//id 19
  529.     {
  530.         ChatBot(playerid, 20);
  531.     }
  532.     if (strfind(text, ":O") != -1)//id 19
  533.     {
  534.         ChatBot(playerid, 20);
  535.     }
  536.     if (strfind(text, ":-(") != -1)//id 19
  537.     {
  538.         ChatBot(playerid, 20);
  539.     }
  540.     if (strfind(text, "=(") != -1)//id 19
  541.     {
  542.         ChatBot(playerid, 20);
  543.     }
  544.     if (strfind(text, ";(") != -1)//id 19
  545.     {
  546.         ChatBot(playerid, 20);
  547.     }
  548.     return 1;
  549. }
Add Comment
Please, Sign In to add comment