SA-MP Forums Archive
[Plugin] IRC Plugin - 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: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] IRC Plugin (/showthread.php?tid=98803)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14


IRC Plugin - Incognito - 23.09.2009

IRC Plugin

This plugin allows for the creation and management of IRC bots through the SA-MP server. There are many features, including:
Changelog

GitHub Commit History

Refer to the CHANGES file the binary package for the full changelog.

Enum

pawn Code:
enum
{
    E_IRC_CONNECT_ATTEMPTS,
    E_IRC_CONNECT_DELAY,
    E_IRC_CONNECT_TIMEOUT,
    E_IRC_RECEIVE_TIMEOUT,
    E_IRC_RESPAWN
}
Natives
Callbacks
Stock Functions

These functions are used to simplify implementation of IRC_GetChannelUserMode. Note that all of the following will return true if the user is at the requested level or higher. For example, IRC_IsVoice will return true if the user is an op.
Instructions

Create a directory called "plugins" inside of the server directory if one does not already exist. Place the plugin file (irc.dll or irc.so) inside of this directory.

Add the following line to server.cfg so that the plugin will load the next time the server starts:

Windows:
Code:
plugins irc.dll
Linux:
Code:
plugins irc.so
On Windows, add irc.inc to the pawno\include folder. Include this file in any of the scripts the server is running:

pawn Code:
#include <irc>
Recompile the scripts with any desired natives and callbacks provided by the include file. Start the server.

Channel Command System

The command system is identical to zcmd, but messages are parsed in IRC_OnUserSay rather than in OnPlayerCommandText. The function syntax resembles the following (this can be placed anywhere in the script):

pawn Code:
IRCCMD:command(botid, channel[], user[], host[], params[])
{
    /* ... */
}
Note that if two or more bots are present in the same channel, the bot that needs to process the command must be specified. Otherwise, all of the bots will process it, which is usually undesired. For example:

pawn Code:
new botID = IRC_Connect(/* ... */);

IRCCMD:command(botid, channel[], user[], host[], params[])
{
    if (botid == botID)
    {
        /* ... */
    }
}
This is done automatically for bots in groups (IRC_OnUserSay is called only once).

The command prefix ('!') can be changed by editing the COMMAND_PREFIX constant in irc.inc.

Better examples are in the filterscript.

Notes
Download

The latest compiled binaries will always be here:

GitHub Releases Page

The source can be browsed here. This repository can also be cloned.

The Windows version requires the Microsoft Visual C++ 2015 Redistributable Package.

The OpenSSL library is required for the SSL version of the plugin. If the server is running Windows, download the Win32 OpenSSL Light Installer from Shining Light Productions. If the server is running Linux, install the "openssl" package.


Re: [REL] IRC Plugin v1.0 - Blacklite - 23.09.2009

Woaaaah.

Awesome. About time we got something like this!

Really good stuff man, keep it up!


Re: [REL] IRC Plugin v1.0 - lpfthings - 23.09.2009

Last night I was wondering if there was a more stable script for this!

I'll try it out on my server, and the .3 server too


Re: [REL] IRC Plugin v1.0 - VIRUXE - 23.09.2009

Good thing you've really managed to create a proper IRC Plugin for us. Thanks.


Re: [REL] IRC Plugin v1.0 - Correlli - 23.09.2009

Keep up the good work.


Re: [REL] IRC Plugin v1.0 - KingJ - 23.09.2009

Great work!

I'm sure a lot of servers will find this extremely useful.


Re: [REL] IRC Plugin v1.0 - [JIeXa] - 23.09.2009

Very good job! Could you write a plugin to work with sockets?


Re: [REL] IRC Plugin v1.0 - Jay_ - 23.09.2009

Excellent! Using at my server


Re: [REL] IRC Plugin v1.0 - gijsmin - 23.09.2009

Greaaat!!!!
Really Great thanks 100000x
Thanks!!!

EDIT:
if i want to compile this i get a error:
Code:
1>------ Build started: Project: irc, Configuration: Release Win32 ------
1>Compiling...
1>main.cpp
1>h:\irc plugin\source\main.h(37) : fatal error C1083: Cannot open include file: 'boost/algorithm/string.hpp': No such file or directory
1>irc.cpp
1>h:\irc plugin\source\main.h(37) : fatal error C1083: Cannot open include file: 'boost/algorithm/string.hpp': No such file or directory
1>amxplugin.cpp
1>Build log was saved at "file://h:\IRC Plugin\source\Release\BuildLog.htm"
1>irc - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



Re: [REL] IRC Plugin v1.0 - Westie - 23.09.2009

That's pretty obvious, you'll need the boost library.


Re: [REL] IRC Plugin v1.0 - Goldkiller - 23.09.2009

Sounds great!
Will test it these days,if everything works fine I'm going to use this irc plugin for gAdmin.

Suggestion:
IRC_JoinChannel(botid, const channel[], password[] );


Re: [REL] IRC Plugin v1.0 - gijsmin - 23.09.2009

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
That's pretty obvious, you'll need the boost library.
yeah how to include it lol?
wich folder/direction?


Re: [REL] IRC Plugin v1.0 - Burridge - 23.09.2009

I love you! No HOMO!


Re: [REL] IRC Plugin v1.0 - yelkreb - 23.09.2009

Awesome.


Re: [REL] IRC Plugin v1.0 - [LL]InstabiC - 23.09.2009

Nice, but the grouping and stuff doesn't seem to work too nice. It might just be me but I've been testing and what I get is:


Quote:

[20:38:08] <TESTIE_03> - Server Information -
[20:38:08] <TESTIE_03> Players: 0/16
[20:38:08] <TESTER_03> IP Address: 95.211.6.150:7777

While I call this code:
pawn Code:
IRC_GroupSay(ircGroup, channel, "7- Server Information -");

format(str, sizeof(str), "4IP Address:17 %s:%s", SERVER_IP, SERVER_PORT);
IRC_GroupSay(ircGroup, channel, str);

format(str, sizeof(str), "4Players:17 %d/%d", GetOnlinePlayers(), maxPlayers);
IRC_GroupSay(ircGroup, channel, str);
And my IRC connections are this:
pawn Code:
ircBot[0] = IRC_Connect(IRC_SERVER, IRC_PORT, ircName[0], IRC_REALNAME, IRC_HOSTNAME);
ircBot[1] = IRC_Connect(IRC_SERVER, IRC_PORT, ircName[1], IRC_REALNAME, IRC_HOSTNAME);
ircGroup = IRC_CreateGroup();
IRC_AddToGroup(ircGroup, ircBot[0]);
IRC_AddToGroup(ircGroup, ircBot[1]);
So... shouldn't it be:
Quote:

[20:38:08] <TESTIE_03> - Server Information -
[20:38:08] <TESTER_03> IP Address: 95.211.6.150:7777
[20:38:08] <TESTIE_03> Players: 0/16

I had the same issues with Jacob's IRC plugin and my only solution was to make one bot send the commands.
Am I doing something wrong or what's going on? I would appreciate help!

By the way, it is great to see a new IRC plugin. Thanks a lot Incognito, you're great.
I love the RAW message parsing you've added as OnReceiveRaw... also all the groups and efficiency.

Please help!


Re: [REL] IRC Plugin v1.0 - gijsmin - 23.09.2009

Great work


Re: [REL] IRC Plugin v1.0 - Incognito - 23.09.2009

Thanks!

InstabiC: Make sure that you are not adding bots to the group twice. It is best to add them in IRC_OnConnect and remove them in IRC_OnDisconnect to ensure that this does not happen.

Gijs: Try commenting out IRC_OnReceiveRaw. The connect message is probably too big to write to a file. I will fix this in my example filterscript now.


Re: [REL] IRC Plugin v1.0 - [LL]InstabiC - 23.09.2009

Quote:
Originally Posted by Incognito
InstabiC: Make sure that you are not adding bots to the group twice. It is best to add them in IRC_OnConnect and remove them in IRC_OnDisconnect to ensure that this does not happen.
Thank you for the reply.

I now assign the bots into groups under IRC_OnConnect. It seems a little better but when I type the command like 5 times in a row, pretty fast (a second interval?) it still messes up it atleast once. But this is certainly better than it was with Jacob's plugin so thanks a bunch!


Re: [REL] IRC Plugin v1.0 - lavamike - 24.09.2009

Very nice, I will have to test this out later!


Re: [REL] IRC Plugin v1.0 - AnthonyL - 24.09.2009

Good work! Thank you so much for this.