VRocker Posted January 9, 2008 Share Posted January 9, 2008 (edited) 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 January 14, 2008 by Guest Link to comment
Mount Posted January 9, 2008 Share Posted January 9, 2008 (edited) 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 January 11, 2008 by Guest Link to comment
VRocker Posted January 9, 2008 Author Share Posted January 9, 2008 Updated the script with !say and fixed several crashes. The !players command can easily be added in by looking at the !say command Link to comment
VRocker Posted January 11, 2008 Author Share Posted January 11, 2008 Updated script to v2! Loads of fixes and a better script. Also added a few more functions which have been requested. Link to comment
Jani Posted January 11, 2008 Share Posted January 11, 2008 Wishlist: Linux version lol Link to comment
Guest Posted January 11, 2008 Share Posted January 11, 2008 Wishlist: Linux version lol I agree, I like your work VRocker! FrankZZ Link to comment
Bazim Posted January 11, 2008 Share Posted January 11, 2008 Please help me ERROR: ...r/mods/deathmatch/resourcecache/IRCEcho/IRC Echo.lua:39: attempt to call global 'ircInit' (a nil value) Link to comment
FNdanielNL Posted January 11, 2008 Share Posted January 11, 2008 well your not the only one whit this problem. I do have it also. The cause is that the module .dll file issnt loaden. But for some kind of strainge reason i cant load it Link to comment
VRocker Posted January 11, 2008 Author Share Posted January 11, 2008 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
Bazim Posted January 11, 2008 Share Posted January 11, 2008 Console me say Unable to find modules/ml_ircecho.dll: invalid ELF header wtf? But I have that modul in dir modules. Link to comment
FNdanielNL Posted January 11, 2008 Share Posted January 11, 2008 whit me he only says Unable to find modules/ml_ircecho.dll! Link to comment
VRocker Posted January 11, 2008 Author Share Posted January 11, 2008 ermm a quick google search on 'Invalid ELF header' suggests its a linux error... This module only works with windows servers at the moment. A linux version is in the pipeline though so be patient Link to comment
Guest Posted January 12, 2008 Share Posted January 12, 2008 Yea I got the same. Its in the modules map but somehow it says it cant find the dll Link to comment
VRocker Posted January 12, 2008 Author Share Posted January 12, 2008 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
HouseMD Posted January 12, 2008 Share Posted January 12, 2008 its possible to do all that without "pIRC", download LUA Sockets, extension, and go from there, i'll start to try to "Script" a IRC Echo of my own, ofc after i finish my banword which is very cool Link to comment
darkdreamingdan Posted January 13, 2008 Share Posted January 13, 2008 Sockets are blocked in MTA's scripting system Link to comment
Guest Posted January 13, 2008 Share Posted January 13, 2008 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
Bazim Posted January 13, 2008 Share Posted January 13, 2008 4 VRocker: when it will be complete for linux? Link to comment
FNdanielNL Posted January 13, 2008 Share Posted January 13, 2008 Chippie do u try him to let him a locked channel join? like modes Operators/Admins only, password protections etc. Because then i doesnt join the channel. But he will if you just have a free open channel when it is good just a thougt but could also be something else >.< Link to comment
DazzaJay Posted January 13, 2008 Share Posted January 13, 2008 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
HouseMD Posted January 13, 2008 Share Posted January 13, 2008 great blocked sockets - that means trace and everything is out the window... Link to comment
Cloudhunter Posted January 14, 2008 Share Posted January 14, 2008 great blocked sockets - that means trace and everything is out the window... Of course it isn't - hasn't this library shown that things can be done without the Lua sockets library? Cloudy Link to comment
VRocker Posted January 14, 2008 Author Share Posted January 14, 2008 Finally figured out how to compile a linux version! From my brief testing it seems to work. It does everything that the windows version does The SO is included in the zip with the windows dll Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now