Modules/bIRC/ircConnect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with '{{ml_birc}} __NOTOC__ This function is used to connect an {{ml_birc|ircbot}} created with {{ml_birc|ircCreateBot}} to a server.<br> '''Note:''' The maximum number of simultanuous…')
 
 
Line 29: Line 29:
     ircConnect ( theBot, "irc.gtanet.com", 6667 )
     ircConnect ( theBot, "irc.gtanet.com", 6667 )
end
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resourceStart )
addEventHandler ( "onResourceStart", getResourceRootElement (), resourceStart )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{ml_birc functions}}
{{ml_birc functions}}

Latest revision as of 16:45, 11 February 2015

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