Jump to content

IRC Script


Wrieh

Recommended Posts

Hey, i use the IRCScript called ''IRCEcho"

Here is the script:

--// VRockers MTASA IRC Echo \\--
--//--- Created by VRocker ---\\--
 
--//------- 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, text ) - Sends a message to the current IRC channel
-- ircNotice( IRCConnection, Nick, text ) - Sends a notice to Nick
-- 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, text ) - 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
 
root = getRootElement()
szChans = {}
 
function onResourceStart( res )
ircInit( )
 
if ( res == getThisResource () ) then
	pIRC = ircOpen( "irc.gtanet.com", "6667", "Partyandco", "#Partyandco" )
	szChans[ pIRC ] = "#Partyandco"
end
 
if pIRC then
	ircMessage( pIRC, szChans[ pIRC ], "Resource Started: " .. getResourceName( res ) )
end
end
 
function onResourceStop( res )
if ( res == getThisResource () ) then
if pIRC then
		ircDisconnect( pIRC )
		pIRC = nil
end
end
 
if pIRC then
	ircMessage( pIRC, szChans[ pIRC ], "Resource Stopped: " .. getResourceName( res ) )
end
 
end
 
function onPlayerJoin()
if pIRC then
	ircMessage( pIRC, szChans[ pIRC ], "5* " .. getPlayerName( source ) .. " Have joined the server." )
end
end
 
function onPlayerQuit( reason )
if pIRC then
	ircMessage( pIRC, szChans[ pIRC ], "5* " .. getPlayerName( source ) .. " Have left the server. (" .. reason .. ")" )
end
end
 
function onPlayerChat( text )
if pIRC then
	ircMessage( pIRC, szChans[ pIRC ], "12" .. getPlayerName( source ) .. ": " .. text )
end
end
 
function onPlayerWasted( ammo, attacker, weapon, bodypart )
if pIRC then
local causeOfDeath = getWeaponNameFromID ( weapon )
if attacker then
if attacker == source then
			ircMessage( pIRC, szChans[ pIRC ], "3" .. getPlayerName( attacker ) .. " killed himself. (" .. causeOfDeath .. ")" )
else
			ircMessage( pIRC, szChans[ pIRC ], "3" .. getPlayerName( attacker ) .. " killed " .. getClientName( source ) .. ". (" .. causeOfDeath .. ")" )
end
else
		ircMessage( pIRC, szChans[ pIRC ], "3" .. getPlayerName( source ) .. " died. (" .. causeOfDeath .. ")" )
end	
end
end
 
--// Callbacks \\--
function irc_onConnecting( szIP, usPort )
outputServerLog( "Connecting to IRC (" .. szIP .. ":" .. tostring( usPort ) .. ")" )
end
 
function irc_onConnected()
outputServerLog( "IRC Connected!" )
end
 
function irc_onDisconnected()
outputServerLog( "IRC Disconnected \"{SMILIES_PATH}/icon_sad.gif\" alt=\"\" title=\"Sad\" />" )
end
 
function irc_onPrivMsg( szChannel, szNick, szText )
outputServerLog( "IRC <> " .. szNick .. ": " .. szText )
 
if string.find( szText, "!say" ) == 1 then
outputChatBox(szNick .. " [iRC]: " .. string.sub( szText, 6 ) )
elseif string.find( szText, "!players" ) == 1 then
	ircMessage( pIRC, szChannel, "4There are currently " .. getPlayerCount() .. " players connected" )
end
end
 
function irc_onNotice( szFrom, szTo, szText )
outputServerLog( "IRC Notice <> " .. szFrom .. ": " .. szText )
 
if szFrom == "NickServ" then
if string.find( szText, "This nickname is registered" ) then
		ircMessage( pIRC, "nickserv", "NORMAL IS HERE PASS" )
end
end
end
 
function irc_onJoin( szChan, szNick )
outputServerLog( "IRC <> " .. szNick .. " joined " .. szChan )
end
 
function irc_onPart( szChan, szNick )
outputServerLog( "IRC <> " .. szNick .. " left " .. szChan )
end
 
function irc_onQuit( szNick )
outputServerLog( "IRC <> " .. szNick .. " quit IRC." )
end
 
function irc_onRaw( text )
--outputServerLog( text )
end
 
function irc_onNickChange( oldNick, newNick )
outputServerLog( "IRC <> " .. newNick .. " changed their nick to " .. oldNick )
end
 
 
addEventHandler( "onResourceStart", root, onResourceStart )
addEventHandler( "onResourceStop", root, onResourceStop )
addEventHandler( "onPlayerJoin", root, onPlayerJoin )
addEventHandler( "onPlayerQuit", root, onPlayerQuit )
addEventHandler( "onPlayerChat", root, onPlayerChat )
addEventHandler( "onPlayerWasted", root, onPlayerWasted)

Whats wrong with it?

I started my server with the loaded module. And he says this script is loaded to. But when i try to run it my server restarts?? And i cant see anything happening on IRC

I use btw ServerFFS>

Edited by Guest
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...