SA-MP Forums Archive
IRC Bots +REP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: IRC Bots +REP (/showthread.php?tid=609046)



IRC Bots +REP - ctopha - 08.06.2016

Hello everybody, i have a strange thing on my IRC system, i have added 2 new cmds to it in the script and my bots were 4 bots, and now while restarting the server One bot only that is joining and while trying re-connecting bots CMD, it fails and it force one bot only to join ID 1 and sometimes no bot will join + my IRC plugin is updated
Код:
//=== IRC Config ===
#define IRC
#define IRC_SERVER  	"irc.irchound.tk"
#define IRC_PORT    	6667
#define IRC_REALNAME    "UoS"
#define IRC_HOSTNAME    "UoS"
#define IRC_CHANNEL     "#UoS.echo"
#define IRC_aCHANNEL    "#UoS-Staff"
#define IRC_BOT_1_NAME  "UoS-1"
#define IRC_BOT_2_NAME  "UoS-2"
#define IRC_BOT_3_NAME  "UoS-3"
#define IRC_BOT_4_NAME  "UoS-4"
#define IRC_NICKSERV            "Nickserv"
#define IRC_NOTICE_REGISTER 	"This nickname is registered and protected"
#define IRC_NOTICE_NOREGISTER   "Your nick isn't registered"
#define IRC_NOTICE_PASSWORD_OK  "Password accepted"
#define IRC_NOTICE_PASSWORD_NO  "Password incorrect"
#define IRC_IDENTIFY_RAW        "PRIVMSG NickServ :IDENTIFY 1111"
#define IRC_REGISTER_RAW        "PRIVMSG NickServ :REGISTER 1111 actopha@yahoo.com"
#define IRC_NOTICE_REGISTERED   "registered under your account"

//=== [IRC Vars] ===
#define MAX_BOTS (4)
new ircName[MAX_BOTS][16];
new	ircBot[MAX_BOTS];
new ircGroup;
new bool:ircBotConnected[4],
	bool:ircBotInChannel[4],
	bool:ircIdentified[4];


/*==============================================================================
         					  IRC SYSTEM
===============================================================================*/
stock IRC_SetUp()
{
	// Set the IRC names
	ircName[0] = IRC_BOT_1_NAME;
	ircName[1] = IRC_BOT_2_NAME;
	ircName[2] = "UoS-3";
	ircName[3] = "UoS-4";
	SetTimerEx("IRC_ConnectDelay", 1000, 0, "d", 1); // Connect the first bot with a one-second delay
	SetTimerEx("IRC_ConnectDelay", 2000, 0, "d", 2); // Connect the second bot with a two-second delay
	SetTimerEx("IRC_ConnectDelay", 3000, 0, "d", 3); // Connect the third bot with a three-second delay
	SetTimerEx("IRC_ConnectDelay", 4000, 0, "d", 4); // Connect the 4th bot with a four-second delay

	// Create the IRC groups
	ircGroup = IRC_CreateGroup();
}

forward IRC_ConnectDelay(tempid);
public IRC_ConnectDelay(tempid)
{
	switch (tempid)
	{
		case 1:
		{
			ircBot[0] = IRC_Connect(IRC_SERVER, IRC_PORT, IRC_BOT_1_NAME, IRC_REALNAME, IRC_HOSTNAME);
		}
		case 2:
		{
			ircBot[1] = IRC_Connect(IRC_SERVER, IRC_PORT, IRC_BOT_1_NAME, IRC_REALNAME, IRC_HOSTNAME);
		}
		case 3:
		{
			ircBot[2] = IRC_Connect(IRC_SERVER, IRC_PORT, IRC_BOT_1_NAME, IRC_REALNAME, IRC_HOSTNAME);
		}
		case 4:
		{
			ircBot[3] = IRC_Connect(IRC_SERVER, IRC_PORT, IRC_BOT_1_NAME, IRC_REALNAME, IRC_HOSTNAME);
		}
	}
	return 1;
}

stock IRC_QuitBots()
{
	IRC_Quit(ircBot[0], "UoSServer.tk (server restarting)");
	IRC_Quit(ircBot[1], "UoSServer.tk (server restarting)");
	IRC_Quit(ircBot[2], "UoSServer.tk (server restarting)");
	IRC_Quit(ircBot[3], "UoSServer.tk (server restarting)");
}

public IRC_OnConnect(botid)
{
	ircBotConnected[botid] = true;
	IRC_JoinChannel(botid, "#UoS.echo");
	IRC_JoinChannel(botid, "#UoS-Staff");
	printf("IRC_OnConnect(%d): Bot ircBot[%d] has connected.", botid, botid);
	IRC_AddToGroup(ircGroup, botid);
}



Re: IRC Bots +REP - ctopha - 08.06.2016

Why there is no reply?