Modules/bIRC/ircUnregister: 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 unregister an {{ml_birc|ircbot}} for the current resource. It is the opposite function for {{ml_birc|ircRegister}}. ==Syntax== <c…')
 
No edit summary
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool ircUnregister ( ircbot theBot )
bool ircUnregister ( ircbot theBot, [ string resourceName = getResourceName ( getThisResource() ) ] )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''theBot:''' The ircbot which you want to stop calling the callbacks for current resource.
*'''theBot:''' The ircbot which you want to stop calling the callbacks.
 
===Optional Arguments===
{{OptionalArg}}
*'''resourceName:''' The name of resource from which the ircbot should be unregistered. The resource specified must be running. Defaults to current resource's name.


===Returns===
===Returns===

Revision as of 10:13, 15 August 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 unregister an ircbot for the current resource. It is the opposite function for ircRegister.

Syntax

bool ircUnregister ( ircbot theBot, [ string resourceName = getResourceName ( getThisResource() ) ] )

Required Arguments

  • theBot: The ircbot which you want to stop calling the callbacks.

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.

  • resourceName: The name of resource from which the ircbot should be unregistered. The resource specified must be running. Defaults to current resource's name.

Returns

Returns true if unregistering callbacks was succesful, false otherwise.

Example

This example creates an ircbot called DummyBot on when resource ircecho starts and makes it unable to call the callback functions inside the resource.

Click to collapse [-]
Resource: ircecho
function resourceStart()
    theBot = ircCreateBot ( "DummyBot" )
    ircUnregister ( theBot )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resourceStart )

-- This callback function will never be called!
function event_ircOnText ( theBot, channel, sender, message )
    if channel == ircGetName( theBot ) then
        outputServerLog ( "[IRC-ECHO] " .. ircGetName( theBot ) .. " received PM from " .. sender .. ": " .. message )
    else
        outputServerLog ( "[IRC-ECHO] " .. ircGetName( theBot ) .. " received text on " .. channel .. " from " .. sender .. ": " .. message )
    end
end

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other