Advertisement
Guest User

Untitled

a guest
Nov 16th, 2010
4,452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.12 KB | None | 0 0
  1. /*
  2.     Shadow- : Chat Bot, Version 1
  3.     Credits to - Pandabear for helping me with minor bugs.
  4. */
  5.  
  6.  
  7. #include <a_samp>
  8.  
  9. #define MAX_MESSAGES 100
  10.  
  11. #define TIMER 30000 // This will set the Timer Length (Miliseconds) For the Random Messages
  12.  
  13. #define COLOR_BOT 0xFF00FFFF // This will set the Bot's Color (Pink by Default)
  14.  
  15. new BotName[24] = "Sophie"; // This will set the Bot's Name
  16. new RANDOMMSG = 1; // 1 = On - 0 = Off  ( 0 = only SendBotMessage() without RandomMessage - 1 = Everything will work)
  17. new MAXMESSAGE;
  18. new BOTMESSAGE[MAX_PLAYERS][128];
  19.  
  20. forward Random(playerid);
  21.  
  22. new RandomMsg[][] =
  23. {
  24.     "Hey,",
  25.     "Sup, ",
  26.     "Hiya, ",
  27.     "Wasssup, "
  28. };
  29.  
  30. public OnFilterScriptInit()
  31. {
  32.     if(RANDOMMSG == 1)
  33.     {
  34.         SetTimer("SendRandomMessage",TIMER,1);
  35.     }
  36.  
  37.     AddRandomMessage("Hey, Did you know, I'm a bot?");
  38.     AddRandomMessage("Don't you just love Death-Matching?");
  39.  
  40.     print("Shadow's Chatbot Loaded");
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerConnect(playerid)
  45. {
  46.     SendBotMessage("Welcome to 'My Server' Please Read the /rules or ill rape you.");
  47.     return 1;
  48. }
  49.  
  50. forward SendRandomMessage();
  51. public SendRandomMessage()
  52. {
  53.     for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
  54.     {
  55.         if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
  56.         {
  57.             new pName[18];
  58.             format(pName,sizeof(pName),"%s",PlayerName(playerid));
  59.             new ColorSave = GetPlayerColor(playerid);
  60.             SetPlayerColor(playerid,COLOR_BOT);
  61.             SetPlayerName(playerid,BotName);
  62.             SendPlayerMessageToAll(playerid,BOTMESSAGE[random(MAXMESSAGE)]);
  63.             SetPlayerColor(playerid,ColorSave);
  64.             SetPlayerName(playerid,pName);
  65.             return 1;
  66.         }
  67.     }
  68.     return 1;
  69. }
  70.  
  71. forward SendBotMessage(msg[]);
  72. public SendBotMessage(msg[])
  73. {
  74.     for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
  75.     {
  76.         if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
  77.         {
  78.             new pName[18];
  79.             format(pName,sizeof(pName),"%s",PlayerName(playerid));
  80.             new ColorSave = GetPlayerColor(playerid);
  81.             SetPlayerColor(playerid,COLOR_BOT);
  82.             SetPlayerName(playerid,BotName);
  83.             SendPlayerMessageToAll(playerid,msg);
  84.             SetPlayerColor(playerid,ColorSave);
  85.             SetPlayerName(playerid,pName);
  86.             return 1;
  87.         }
  88.     }
  89.     return 1;
  90. }
  91.  
  92. stock AddRandomMessage(msg[])
  93. {
  94.     format(BOTMESSAGE[MAXMESSAGE],128,"%s",msg);
  95.     MAXMESSAGE++;
  96.     return 1;
  97. }
  98.  
  99. stock PlayerName(playerid)
  100. {
  101.     new pName2[MAX_PLAYER_NAME];
  102.     GetPlayerName(playerid, pName2, MAX_PLAYER_NAME);
  103.     return pName2;
  104. }
  105.  
  106. public OnPlayerText(playerid, text[])
  107. {
  108.     if(!strcmp(text, "Ha", true) || !strcmp(text, "lol", true) || !strcmp(text, "rofl", true) || !strcmp(text, "lmao", true))
  109.     {
  110.         SendPlayerMessageToAll(playerid, text);
  111.         SendBotMessage("ROFL - COPTER");
  112.         return 0;
  113.     }
  114.  
  115.     if(!strcmp(text, "Hi", true) || !strcmp(text, "Sup", true) || !strcmp(text, "Sophie", true) || !strcmp(text, "Hiya", true))
  116.     {
  117.         SendPlayerMessageToAll(playerid, text);
  118.         Random(playerid);
  119.         return 0;
  120.     }
  121.  
  122.     return 1;
  123. }
  124.  
  125. public Random(playerid)
  126. {
  127.         new str[128];
  128.         new randMSG = random(sizeof(RandomMsg));
  129.         format(str, sizeof(str), "%s %s", RandomMsg[randMSG], PlayerName(playerid));
  130.         SendBotMessage(str);
  131.         return 1;
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement