Jump to content

[REL] IRC Server Echo


VRocker

Recommended Posts

After noticing the lack of IRC Echo bots for MTASA (and after being asked by Mount) i decided to make one.

This echo consists of a module and a lua script. The module connects to the IRC server and parses several commands aswell as keeping the connection alive.

The script supports multiple connections to the same or differant IRC servers and can change nickname and join channels on demand.

Heres a list of functions and callbacks:

 Functions: 
    ircInit() - Initializes the module with the resource so it can be used 
    ircOpen( IP, Port, Nick, Channel, [ Password ] ) - Readys a connection to a specified IRC Server. Returns IRCConnection 
    ircDisconnect( IRCConnection ) - Disconnects from the IRC Server 
    ircMessage( IRCConnection, channel, text ) - Sends a message to channel (can be channel name or nickname) 
    ircNotice( IRCConnection, Nick, text ) - Sends a notice to Nick (can be nickname or channel name) 
    ircChangeNick( IRCConnection, newNick ) - Changes the bots nickname to newNick 
    ircJoin( IRCConnection, channel ) - Joins a channel 
    ircPart( IRCConnection, channel) - Parts a channel 
    ircRaw( IRCConnection, text ) - Sends raw commands to the IRC Server 
    ircIsVoice( IRCConnection, szChan, szNick ) - Checks if the nickname is voiced on the channel 
    ircIsHalfop( IRCConnection, szChan, szNick ) - Checks if the nickname is a half op on the channel 
    ircIsOp( IRCConnection, szChan, szNick ) - Checks if the nickname is an op on the channel 
    ircIsSuper( IRCConnection, szChan, szNick ) - Checks if the nickname is a super op on the channel 
    ircIsOwner( IRCConnection, szChan, szNick ) - Checks if the nickname is an owner on the channel 
    ircGetStatus( IRCConnection, szChan, szNick ) - Returns the status of the person ( 0 = no status, 5 = owner ) 
  

 Callbacks: 
    irc_onConnecting( IP, Port ) - Called when the IRC connection is connecting 
    irc_onConnected() - Called when the server is connected 
    irc_onDisconnected() - Called when the server loses connection to the IRC server 
    irc_onFailedConnection() - Called when the server loses connection to the IRC server 
    irc_onPrivMsg( nick, text ) - Called when somebody speaks in the current channel or PMs the bot 
    irc_onNotice( nick, text ) - Called when the bot is sent a notice 
    irc_onJoin( nick, channel ) - Called when a user enters the channel 
    irc_onPart( nick, channel ) - Called when a user leaves the channel 
    irc_onQuit( nick ) - Called when a user quits IRC 
    irc_onNickChange( oldNick, newNick ) - Called when somebody changes their nickname 
    irc_onRaw( text ) - Called when an unrecognised IRC command is recieved 
  

Any problems or bugs just let me know and i'll help. Suggestions are always welcome too :)

The echo is now for both Windows and Linux. Linux version may be dodgy so please leave some feedback on it :)

Heres the link (attachment doesn't seem to be working :(): Linkeh

*UPDATED 11/01/08* Version 2 now released!

*UPDATED 14/01/08* Linux version now available!

Edited by Guest
Link to comment
  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

TY VRocker

Wishlist:

- Custom QUIT messages

- Custom Realname and ident

Enchanted !players script! (just replace it in the lua file):

    elseif string.find( szText, "!players" ) == 1 then 
        local c = 0 
        local str = " " 
        for index, thePlayer in ipairs(getElementsByType("player")) do 
        if (str ~= " ") then 
        str = str .. ", " 
        end 
            str = str .. getClientName(thePlayer) 
            c = c + 1 
        end 
        if (c == 0) then 
            ircMessage(pIRC, channel1, "There are no players online") 
        elseif (c == 1) then 
            ircMessage(pIRC, channel1, "1 player online:" .. str) 
        else 
            ircMessage(pIRC, channel1, tostring(c) .. " players online:" .. str) 
        end 
    end 

Edited by Guest
Link to comment

Yeh this occurs when the module isn't loaded. The server should say MODULE: Loaded 'IRCEcho' by 'VRocker' (2.0) or something like that on server start. If it doesn't say anything about modules then your using the wrong way to load modules in the mtaconfig.conf

In the mtaconfig.conf is says to use example.dll

That is the wrong way to load. That will cause the error you are recieving.

Instead use

It should then work but i have heard of people having issues loading modules (failing to load and not being able to find the file even though it exists in the right place)

Link to comment

To everybody having the error 'Cannot load/find module 'ml_IRCEcho.dll'...

The problem was that you needed the Visual Studio 2005 redist since i compiled the dll on 2005.

Now compiled a new dll which i have included in the zip so just simply redownload the package :)

Link to comment

Got it all working now.

But I need to let it /sajoin by a server adminstrator everytime I want to put it up.

Is there any other way to get it on a irc channel without sajoin?

Link to comment

I have an interesting problem with it.....

i have edited the file so it joins #PotholeStudios on irc.rizon.net and ofcourse its name was changed to [PS]DM-Relay

that has been the only thing i have changed.

When any resource is started / stopped from in game, it relays this to IRC....

[03:52 AM] [PS]DM-Relay: Resource

all it says when somone joins the game is this...

[03:54 AM] [PS]DM-Relay: *

when somone quits...

[03:54 AM] [PS]DM-Relay: *

when somone says somthing in game, it only relays thier name, and not thier messgae.....

[03:54 AM] [PS]DM-Relay: [PS]DazzaJay[AU]:

and when somone says somthing in the IRC channel, it does not go to the game, it just shows thier message in the server window:

[03:54:06] IRC <> [PS]DazzaJay[AU]: Test Test

there are no error messages shown in the server window, so i have no idea whats wrong with it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...