Advertisement
danielschumacher98

Chatbot V0.1BETA

Jun 18th, 2011
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define MAX_MESSAGES 100 //Change it!
  4.  
  5. #define BOTTIMER 50000 // This will set the Timer Length (Miliseconds) For the Random Messages
  6.  
  7. #define COLOR_BOT 0xFF00FFFF // This will set the Bot's Color (Pink by Default)
  8.  
  9. new BotName[24] = "Bot"; // Change it to the Name you want!
  10. new RandomMessages = 1; // 1 = On - 0 = Off ( 0 = only SendBotMessage() without RandomMessage - 1 = Everything will work)
  11. new Max_Msg;
  12. new BotMsg[MAX_PLAYERS][128]; //Change the 128 to the Max Players on your Server!
  13.  
  14. forward Random(playerid);
  15.  
  16. new RandomMsg[][] =
  17. {
  18. "Hey,",
  19. "Sup, ",
  20. "Hiya, ",
  21. "Wasssup, "
  22. };
  23.  
  24. public OnFilterScriptInit()
  25. {
  26. if(RandomMessages == 1)
  27. {
  28. SetTimer("SendRandomMessage",BOTTIMER,1);
  29. }
  30. //Change every Message to the Message you want!
  31. AddRandomMessage("");
  32. AddRandomMessage("");
  33. AddRandomMessage("");
  34. AddRandomMessage("");
  35. AddRandomMessage("");
  36. AddRandomMessage("");
  37. AddRandomMessage("");
  38. AddRandomMessage("");
  39. AddRandomMessage("");
  40. AddRandomMessage("");
  41. AddRandomMessage("");
  42. print("Chatbot by Daniel Schumacher loaded!");
  43. return 1;
  44. }
  45.  
  46. public OnPlayerConnect(playerid)
  47. {
  48. SendBotMessage("Welcome to 'The Servername'! We hope you have fun with Playing on this Server!"); //Change 'The Servername' to your Servername!
  49. return 1;
  50. }
  51.  
  52. forward SendRandomMessage();
  53. public SendRandomMessage()
  54. {
  55. for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
  56. {
  57. if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
  58. {
  59. new pName[18];
  60. format(pName,sizeof(pName),"%s",PlayerName(playerid));
  61. new ColorSave = GetPlayerColor(playerid);
  62. SetPlayerColor(playerid,COLOR_BOT);
  63. SetPlayerName(playerid,BotName);
  64. SendPlayerMessageToAll(playerid,BotMsg[random(Max_Msg)]);
  65. SetPlayerColor(playerid,ColorSave);
  66. SetPlayerName(playerid,pName);
  67. return 1;
  68. }
  69. }
  70. return 1;
  71. }
  72.  
  73. forward SendBotMessage(msg[]);
  74. public SendBotMessage(msg[])
  75. {
  76. for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
  77. {
  78. if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
  79. {
  80. new pName[18];
  81. format(pName,sizeof(pName),"%s",PlayerName(playerid));
  82. new ColorSave = GetPlayerColor(playerid);
  83. SetPlayerColor(playerid,COLOR_BOT);
  84. SetPlayerName(playerid,BotName);
  85. SendPlayerMessageToAll(playerid,msg);
  86. SetPlayerColor(playerid,ColorSave);
  87. SetPlayerName(playerid,pName);
  88. return 1;
  89. }
  90. }
  91. return 1;
  92. }
  93.  
  94. stock AddRandomMessage(msg[])
  95. {
  96. format(BotMsg[Max_Msg],128,"%s",msg);
  97. Max_Msg++;
  98. return 1;
  99. }
  100.  
  101. stock PlayerName(playerid)
  102. {
  103. new pName2[MAX_PLAYER_NAME];
  104. GetPlayerName(playerid, pName2, MAX_PLAYER_NAME);
  105. return pName2;
  106. }
  107.  
  108. public OnPlayerText(playerid, text[])
  109. {
  110. //Change the Text with "" to that you want!
  111. if(!strcmp(text, "Ha", true) || !strcmp(text, "lol", true) || !strcmp(text, "rofl", true) || !strcmp(text, "lmao", true))
  112. {
  113. SendPlayerMessageToAll(playerid, text);
  114. SendBotMessage("ROFL!");
  115. return 0;
  116. }
  117. if(!strcmp(text, "Thank you", true) || !strcmp(text, "thankyou", true) || !strcmp(text, "thanks", true) || !strcmp(text, "ty", true))
  118. {
  119. SendPlayerMessageToAll(playerid, text);
  120. SendBotMessage("Your welcome");
  121. return 0;
  122. }
  123.  
  124. if(!strcmp(text, "Hi", true) || !strcmp(text, "Sup", true) || !strcmp(text, "BigBird", true) || !strcmp(text, "Hiya", true))
  125. {
  126. SendPlayerMessageToAll(playerid, text);
  127. Random(playerid);
  128. return 0;
  129. }
  130.  
  131. if(!strcmp(text, "me?", true))
  132. {
  133. SendPlayerMessageToAll(playerid, text);
  134. SendBotMessage("Yes you");
  135. return 0;
  136. }
  137.  
  138. if(!strcmp(text, "fuck", true) || !strcmp(text, "bitch", true) || !strcmp(text, "dick", true) || !strcmp(text, "slut", true))
  139. {
  140. SendPlayerMessageToAll(playerid, text);
  141. SendBotMessage("Hey Don't swear, Theres a lady in the server :)");
  142. return 0;
  143. }
  144. if(!strcmp(text, "Sleepy", true) || !strcmp(text, "Bored", true))
  145. {
  146. SendPlayerMessageToAll(playerid, text);
  147. SendBotMessage("Do some stunts then");
  148. return 0;
  149. }
  150. if(!strcmp(text, "Hungry", true) || !strcmp(text, "drink", true) || !strcmp(text, "thirsty", true) || !strcmp(text, "water", true))
  151. {
  152. SendPlayerMessageToAll(playerid, text);
  153. SendBotMessage("I've got nothing in my fridge");
  154. return 0;
  155. }
  156. if(!strcmp(text, "Bot", true))
  157. {
  158. SendPlayerMessageToAll(playerid, text);
  159. SendBotMessage("Seifo's sexy)");
  160. return 0;
  161. }
  162. if(!strcmp(text, "Bot sucks", true))
  163. {
  164. SendPlayerMessageToAll(playerid, text);
  165. SendBotMessage("no you)");
  166. return 0;
  167. }
  168.  
  169. return 1;
  170. }
  171.  
  172. public Random(playerid)
  173. {
  174. new str[128];
  175. new randMSG = random(sizeof(RandomMsg));
  176. format(str, sizeof(str), "%s %s", RandomMsg[randMSG], PlayerName(playerid));
  177. SendBotMessage(str);
  178. return 1;
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement