Modules/bIRC/ircGetBots

From Multi Theft Auto: Wiki
Revision as of 20:13, 29 July 2009 by Awwu (talk | contribs) (Created page with '{{ml_birc}} __NOTOC__ This function is used to check whether the specified {{ml_birc|ircbot}} is connected to a server. ==Syntax== <syntaxhighlight lang="lua"> bool ircGetBots () </syntaxhighlight> ==…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 check whether the specified ircbot is connected to a server.

Syntax

bool ircGetBots ()

Required Arguments

None

Returns

Returns a table over all created ircbots. Returns an empty table if no ircbots exist.

Example

This example adds a command listbots which can be used to print out all currently available ircbots along with their names to console.

function printOutIrcBots ( thePlayer )
    local ircBots = ircGetBots ()
    if #ircBots == 0 then
        outputConsole ( "There are no ircbots!", thePlayer )
    else
        outputConsole ( "There's " .. #ircBots .. " ircbots:" ) 
        for key, value in ipairs ( ircBots ) do
            outputConsole ( "- " .. ircGetName ( value ) )
        end
    end
end
addCommandHandler ( "listbots", printOutIrcBots )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other