Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BOT_1_NICKNAME "MySQL&IRC_Basic" //Bot Name!
- #define BOT_1_REALNAME "MySQL&IRC_Basic"
- #define BOT_1_USERNAME "MySQL&IRC_Basic"
- #define BOT_2_NICKNAME "MySQL&IRC_Basic2"
- #define BOT_3_NICKNAME "MySQL&IRC_Basic3"
- #define IRC_SERVER "irc.opera.net" // Don't need to change.
- #define IRC_PORT 6667
- #define IRC_CHANNEL "#mysqlbasic" // Change this.
- #define IRC_IDLE "#mysqlbasic.echo" // Change this.
- #define IRC_LIVE "#mysqlbasic.live" // Change this.
- new TEST_MODE = 0;
- new
- gBotID[3],
- gGroupID;
- forward echo_Init();
- public echo_Init()
- {
- if(TEST_MODE == 0)
- {
- SetTimerEx("IRC_ConnectDelay", 500, 0, "d", 1); // Connect the first bot with a delay of 2 seconds
- SetTimerEx("IRC_ConnectDelay", 750, 0, "d", 2); // Connect the second bot with a delay of 3 seconds
- SetTimerEx("IRC_ConnectDelay", 1000, 0, "d", 3); // Connect the second bot with a delay of 4 seconds
- }
- gGroupID = IRC_CreateGroup();
- }
- forward echo_Exit();
- public echo_Exit()
- {
- IRC_Quit(gBotID[0], "MySQL_Basic ->>[Bye]<<-");
- IRC_Quit(gBotID[1], "MySQL_Basic ->>[Bye]<<-");
- IRC_Quit(gBotID[2], "MySQL_Basic ->>[Bye]<<-");
- IRC_DestroyGroup(gGroupID); // Destroy the group
- }
- forward IRC_ConnectDelay(tempid);
- public IRC_ConnectDelay(tempid)
- {
- switch (tempid)
- {
- case 1:
- {
- gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
- }
- case 2:
- {
- gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
- }
- case 3:
- {
- gBotID[2] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_3_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
- }
- }
- return 1;
- }
- public IRC_OnConnect(botid)
- {
- printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
- SetTimerEx("IRC_JoinDelay", 1000, 0, "d", botid);
- IRC_JoinChannel(botid, IRC_CHANNEL);
- IRC_JoinChannel(botid, IRC_IDLE);
- IRC_JoinChannel(botid, IRC_LIVE);
- IRC_AddToGroup(gGroupID, botid); // Add the IRC bot to the group
- return 1;
- }
- forward IRC_JoinDelay(botid);
- public IRC_JoinDelay(botid)
- {
- IRC_JoinChannel(botid, IRC_CHANNEL);
- IRC_JoinChannel(botid, IRC_IDLE);
- IRC_JoinChannel(botid, IRC_LIVE);
- }
- public IRC_OnDisconnect(botid)
- {
- if (botid == gBotID[0])
- {
- SetTimerEx("IRC_ConnectDelay", 1000, 0, "d", 1); // Wait 10 seconds for the first bot
- }
- else if (botid == gBotID[1])
- {
- SetTimerEx("IRC_ConnectDelay", 1500, 0, "d", 2); // Wait 15 seconds for the second bot
- }
- else if (botid == gBotID[2])
- {
- SetTimerEx("IRC_ConnectDelay", 1500, 0, "d", 3); // Wait 15 seconds for the third bot
- }
- IRC_RemoveFromGroup(gGroupID, botid); // Remove the IRC bot from the group
- return 1;
- }
- public IRC_OnJoinChannel(botid, channel[])
- {
- printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
- return 1;
- }
- stock iEcho(text[], chan[] = IRC_CHANNEL) // PARAM: text || PARAM: delay
- {
- if(!TEST_MODE) IRC_GroupSay(gGroupID, chan, text);
- return 1;
- }
- forward iEchoDelay(text[]);
- public iEchoDelay(text[])
- {
- IRC_GroupSay(gGroupID, IRC_CHANNEL, text);
- }
- stock iEchoUse(text[])
- {
- new
- tmp[ 128 ];
- format(tmp, 128, "USAGE: %s", text);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, tmp);
- return 1;
- }
- stock iNotice(target[], text[])
- {
- IRC_GroupNotice(gGroupID, target, text);
- return 1;
- }
- stock iEchoVIP(text[])
- {
- IRC_GroupSay(gGroupID, IRC_CHAN_VIP, text);
- }
- #define IRC_CHAN_ADMIN "@#echo" //General Administrator OP
- stock iEchoAdmin(text[])
- {
- IRC_GroupSay(gGroupID, IRC_CHAN_ADMIN, text);
- }
Advertisement
Add Comment
Please, Sign In to add comment