Modules/bIRC/ircIsConnected: 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 check whether the specified {{ml_birc|ircbot}} is connected to a server. ==Syntax== <syntaxhighlight lang="lua"> bool ircIsConnected ( ircbot th…')
 
 
Line 21: Line 21:
     if theBot then
     if theBot then
         if ircIsConnected ( theBot )
         if ircIsConnected ( theBot )
             outputChatBox ( "Yes, " .. botName .. " is connected!" )
             outputChatBox ( "Yes, " .. botName .. " is connected!", thePlayer )
         else
         else
             outputChatBox ( "Nope, " .. botName .. " isn't connected!" )
             outputChatBox ( "Nope, " .. botName .. " isn't connected!", thePlayer )
         end
         end
     else
     else
         outputChatBox ( "There is no bot called " .. botName .. "!" )
         outputChatBox ( "There is no bot called " .. botName .. "!", thePlayer )
     end
     end
end
end

Latest revision as of 20:13, 29 July 2009

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 ircIsConnected ( ircbot theBot )

Required Arguments

  • theBot: The ircbot which connection state you want to check.

Returns

Returns true if the ircbot is connected, false otherwise.

Example

This example adds a command isbotconnected which can be used to determine if a certain bot is connected or not.

function checkIsBotConnected ( thePlayer, commandName, botName )
    local theBot = ircGetBotByName ( botName )
    if theBot then
        if ircIsConnected ( theBot )
            outputChatBox ( "Yes, " .. botName .. " is connected!", thePlayer )
        else
            outputChatBox ( "Nope, " .. botName .. " isn't connected!", thePlayer )
        end
    else
        outputChatBox ( "There is no bot called " .. botName .. "!", thePlayer )
    end
end
addCommandHandler ( "isbotconnected", checkIsBotConnected )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other