Modules/bIRC/ircDestroyBot: 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 destroy a created {{ml_birc|ircbot}}. After deletion, the ircbot pointer will nolonger be valid. If ircbot is connected, it will be…')
 
 
Line 20: Line 20:
     theBot = ircCreateBot ( "DummyBot" )
     theBot = ircCreateBot ( "DummyBot" )
end
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resourceStart )
addEventHandler ( "onResourceStart", getResourceRootElement (), resourceStart )


function resourceStop()
function resourceStop()
Line 27: Line 27:
     end
     end
end
end
addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), resourceStop )
addEventHandler ( "onResourceStop", getResourceRootElement (), resourceStop )
</syntaxhighlight>
</syntaxhighlight>


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

Latest revision as of 16:46, 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 destroy a created ircbot. After deletion, the ircbot pointer will nolonger be valid. If ircbot is connected, it will be disconnected from the server.

Syntax

bool ircDestroyBot ( ircbot theBot )

Required Arguments

  • theBot: The ircbot which will be destroyed.

Returns

Returns true if ircbot was successfully destroyed, false otherwise.

Example

This example creates an ircbot called DummyBot on resource start and destroys the bot once the resource has stopped.

function resourceStart()
    theBot = ircCreateBot ( "DummyBot" )
end
addEventHandler ( "onResourceStart", getResourceRootElement (), resourceStart )

function resourceStop()
    if theBot then
        ircDestroyBot ( theBot )
    end
end
addEventHandler ( "onResourceStop", getResourceRootElement (), resourceStop )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other