Modules/bIRC/ircConnect

From Multi Theft Auto: Wiki

Package-x-generic.png This function is provided by the external module Basic IRC Module. You must install this module to use this function.

This function is used to connect an ircbot created with ircCreateBot to a server.
Note: The maximum number of simultanuous connections is 5. There is no limit for ircbots but it is not possible to connect more than 5 bots at a time.

Syntax

bool ircConnect ( ircbot theBot, string server, int port, [ string password ] )

Required Arguments

  • theBot: The ircbot which will be connected.
  • server: The name of the server to which the bot will connect, eg. "irc.gtanet.com".
  • port: The port number of the IRC server.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • password: The password for the IRC server.

Returns

Returns true if passed arguments were valid, false otherwise.
Note: Does not return true if ircbot was successfully connected or false if the bot didn't connect. You can check if the bot connected by using callbacks event_ircOnConnect and event_ircOnFailedConnection.

Example

This example creates an ircbot called DummyBot and makes it connect to irc.gtanet.com server on resource start.

function resourceStart()
    theBot = ircCreateBot ( "DummyBot" )
    ircConnect ( theBot, "irc.gtanet.com", 6667 )
end
addEventHandler ( "onResourceStart", getResourceRootElement (), resourceStart )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other