Guest User

IRC Shiznit

a guest
Dec 5th, 2013
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. #define BOT_1_NICKNAME "MySQL&IRC_Basic" //Bot Name!
  2. #define BOT_1_REALNAME "MySQL&IRC_Basic"
  3. #define BOT_1_USERNAME "MySQL&IRC_Basic"
  4.  
  5. #define BOT_2_NICKNAME "MySQL&IRC_Basic2"
  6. #define BOT_3_NICKNAME "MySQL&IRC_Basic3"
  7.  
  8. #define IRC_SERVER "irc.opera.net" // Don't need to change.
  9. #define IRC_PORT 6667
  10. #define IRC_CHANNEL "#mysqlbasic" // Change this.
  11. #define IRC_IDLE "#mysqlbasic.echo" // Change this.
  12. #define IRC_LIVE "#mysqlbasic.live" // Change this.
  13.  
  14. new TEST_MODE = 0;
  15.  
  16. new
  17. gBotID[3],
  18. gGroupID;
  19.  
  20.  
  21. forward echo_Init();
  22. public echo_Init()
  23. {
  24. if(TEST_MODE == 0)
  25. {
  26. SetTimerEx("IRC_ConnectDelay", 500, 0, "d", 1); // Connect the first bot with a delay of 2 seconds
  27. SetTimerEx("IRC_ConnectDelay", 750, 0, "d", 2); // Connect the second bot with a delay of 3 seconds
  28. SetTimerEx("IRC_ConnectDelay", 1000, 0, "d", 3); // Connect the second bot with a delay of 4 seconds
  29. }
  30.  
  31. gGroupID = IRC_CreateGroup();
  32. }
  33.  
  34. forward echo_Exit();
  35. public echo_Exit()
  36. {
  37. IRC_Quit(gBotID[0], "MySQL_Basic ->>[Bye]<<-");
  38. IRC_Quit(gBotID[1], "MySQL_Basic ->>[Bye]<<-");
  39. IRC_Quit(gBotID[2], "MySQL_Basic ->>[Bye]<<-");
  40. IRC_DestroyGroup(gGroupID); // Destroy the group
  41. }
  42.  
  43. forward IRC_ConnectDelay(tempid);
  44. public IRC_ConnectDelay(tempid)
  45. {
  46. switch (tempid)
  47. {
  48. case 1:
  49. {
  50. gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  51. }
  52. case 2:
  53. {
  54. gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  55. }
  56. case 3:
  57. {
  58. gBotID[2] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_3_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  59. }
  60. }
  61. return 1;
  62. }
  63.  
  64. public IRC_OnConnect(botid)
  65. {
  66. printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
  67. SetTimerEx("IRC_JoinDelay", 1000, 0, "d", botid);
  68. IRC_JoinChannel(botid, IRC_CHANNEL);
  69. IRC_JoinChannel(botid, IRC_IDLE);
  70. IRC_JoinChannel(botid, IRC_LIVE);
  71. IRC_AddToGroup(gGroupID, botid); // Add the IRC bot to the group
  72. return 1;
  73. }
  74.  
  75. forward IRC_JoinDelay(botid);
  76. public IRC_JoinDelay(botid)
  77. {
  78. IRC_JoinChannel(botid, IRC_CHANNEL);
  79. IRC_JoinChannel(botid, IRC_IDLE);
  80. IRC_JoinChannel(botid, IRC_LIVE);
  81. }
  82.  
  83. public IRC_OnDisconnect(botid)
  84. {
  85. if (botid == gBotID[0])
  86. {
  87. SetTimerEx("IRC_ConnectDelay", 1000, 0, "d", 1); // Wait 10 seconds for the first bot
  88. }
  89. else if (botid == gBotID[1])
  90. {
  91. SetTimerEx("IRC_ConnectDelay", 1500, 0, "d", 2); // Wait 15 seconds for the second bot
  92. }
  93. else if (botid == gBotID[2])
  94. {
  95. SetTimerEx("IRC_ConnectDelay", 1500, 0, "d", 3); // Wait 15 seconds for the third bot
  96. }
  97. IRC_RemoveFromGroup(gGroupID, botid); // Remove the IRC bot from the group
  98. return 1;
  99. }
  100.  
  101. public IRC_OnJoinChannel(botid, channel[])
  102. {
  103. printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
  104. return 1;
  105. }
  106.  
  107. stock iEcho(text[], chan[] = IRC_CHANNEL) // PARAM: text || PARAM: delay
  108. {
  109. if(!TEST_MODE) IRC_GroupSay(gGroupID, chan, text);
  110. return 1;
  111. }
  112.  
  113. forward iEchoDelay(text[]);
  114. public iEchoDelay(text[])
  115. {
  116. IRC_GroupSay(gGroupID, IRC_CHANNEL, text);
  117. }
  118.  
  119. stock iEchoUse(text[])
  120. {
  121. new
  122. tmp[ 128 ];
  123. format(tmp, 128, "USAGE: %s", text);
  124. IRC_GroupSay(gGroupID, IRC_CHANNEL, tmp);
  125. return 1;
  126. }
  127.  
  128. stock iNotice(target[], text[])
  129. {
  130. IRC_GroupNotice(gGroupID, target, text);
  131. return 1;
  132. }
  133.  
  134. stock iEchoVIP(text[])
  135. {
  136. IRC_GroupSay(gGroupID, IRC_CHAN_VIP, text);
  137. }
  138. #define IRC_CHAN_ADMIN "@#echo" //General Administrator OP
  139. stock iEchoAdmin(text[])
  140. {
  141. IRC_GroupSay(gGroupID, IRC_CHAN_ADMIN, text);
  142. }
Advertisement
Add Comment
Please, Sign In to add comment