SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 16/04/2012, 09:02 PM   #1
Beta Tester
BlueG's Avatar
Join Date: Sep 2007
Location: Los Angeles, CA
Posts: 231
Reputation: 287
Default IRC Bot

IRC Bot v0.1

This include allows you to easily connect/control multiple IRC bots. It requires the socket plugin to work.

PAWN functions:
stock ircbot_connect(server[], port, nickname[], username[], realname[]);
stock ircbot_reconnect(botid);
stock ircbot_say(botid, receiver[], message[]);
stock ircbot_action(botid, receiver[], message[]);
stock ircbot_kick(botid, channel[], user[], reason[]);
stock ircbot_notice(botid, receiver[], message[]);
stock is_bot_connected(botid);
stock ircbot_join(botid, channel[]);
stock ircbot_part(botid, channel[], message[]);
stock ircbot_quit(botid, message[]);
stock ircbot_setmode(botid, channel[], mode[]);
stock ircbot_raw(botid, raw_cmd[]);
forward onBotConnect(botid);
forward onBotDisconnect(botid);
forward onCTCPRequest(botid, user[], request_msg[], user_ident[]);
forward onChannelMessage(botid, user[], channel[], message[], user_ident[]);
forward onIRCCommand(botid, user[], channel[], command[], user_ident[]);
forward onPrivateMessage(botid, user[], message[], user_ident[]);
forward onChannelJoin(botid, user[], channel[], user_ident[]);
forward onChannelPart(botid, user[], channel[], part_msg[], user_ident[]);
forward onBotNotice(botid, source[], message[], user_ident);
forward onUserQuit(botid, user[], leaving_msg[], user_ident[]);
forward onNicknameChange(botid, user[], new_name[], user_ident[]);
forward onChannelKick(botid, user[], victim[], channel[], reason[], user_ident[]);
forward onBotInvite(botid, user[], channel[], user_ident[]);
forward onRawCommand(botid, raw_code, raw_data[]);
forward onChannelMode(botid, user[], channel[], mode[], option[], user_ident[]);
forward onTopicChange(botid, user[], channel[], topic[], user_ident[]);
// simple IRC echo bot
#include <a_samp>
#include <irc_bot>
#define BOT_NICK "TestBot"
#define BOT_USERNAME "TestBot"
#define BOT_REALNAME "Test van Bot"
#define ECHO_CHANNEL "#echo_chan"

new Bot;

public OnFilterScriptInit()
    Bot = ircbot_connect("", 6667, BOT_NICK, BOT_USERNAME, BOT_REALNAME); // lets connect to FoCo Net
	return 1;

public onBotConnect(botid)
    ircbot_join(botid, ECHO_CHANNEL);

public OnPlayerText(playerid, text[])
	if(is_bot_connected(Bot)) {
		new sMessage[256], sName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, sName, MAX_PLAYER_NAME);
		format(sMessage, sizeof sMessage, "4%s: 1%s", sName, text);
		ircbot_say(Bot, ECHO_CHANNEL, sMessage);
	return 1;

public onIRCCommand(botid, user[], channel[], command[], user_ident[])
	if(!strcmp(command, "!test", true)) {
	    ircbot_say(botid, MAIN_CHANNEL, "hi");
	return 1;

BlueG is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 08:37 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.