From Multi Theft Auto: Wiki
|This function is provided by the external module Basic IRC Module. You must install this module to use this function.|
This function can be used to kick user from the specified channel. The specified ircbot often needs to have suitable privileges in order for this to work.
- theBot: The ircbot which is going to do the kicking
- channel: The channel where user should be kicked from
- user: The user who should be kicked
NOTE: When using optional arguments, you must supply all arguments before the one you wish to use. For more information on optional arguments, see Optional Arguments.
- reason: The reason for the kick
Returns true if passed arguments were valid, false otherwise.
Note: Does not return true if the user was successfully kicked or false if it failed. You can check if the user was kicked by using callback event_ircOnKick.
This example creates an ircbot called DummyBot, makes it connect to a server and join a channel. It also includes an IRC command '!kick' which can be used to kick users from the channel.
function resourceStart ( ) theBot = ircCreateBot ( "DummyBot" ) ircConnect ( theBot, "irc.gtanet.com", 6667 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resourceStart ) function event_ircOnConnect ( theBot ) setTimer ( ircJoinChannel, 2000, 1, theBot, "#testchannel" ) end function event_ircOnText ( theBot, channel, sender, message ) if message:find( "!kick" ) then local params = split ( message, string.byte (' ') ) -- params has the string "!kick" which we don't need -- params has the user name if ircIsInChannel ( theBot, channel, params ) then ircKick ( theBot, channel, params ) end end end