Modules/IRCEcho/ircMessage: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{ModuleFunction|IRCEcho}} Displays an message to an IRC Channel ==Syntax== <syntaxhighlight lang="lua"> function ircDisconnect ( IRCConnection irc, string channel, string message ) </syntaxhighlight> ==...)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function ircDisconnect ( IRCConnection irc, string channel, string message )
function ircMessage ( IRCConnection irc, string channel, string message )
</syntaxhighlight>
</syntaxhighlight>
===Required arguments===
===Required arguments===
* '''irc:''' The IRCConnection you wish to disconnect
* '''irc:''' The IRCConnection
* '''channel:''' The channel or person you want to send the message to
* '''message:''' The message


==Example==
==Example==

Latest revision as of 18:58, 13 January 2008


Package-x-generic.png This function is provided by the external module IRCEcho. You must install this module to use this function.

Displays an message to an IRC Channel

Syntax

function ircMessage ( IRCConnection irc, string channel, string message )

Required arguments

  • irc: The IRCConnection
  • channel: The channel or person you want to send the message to
  • message: The message

Example

Example 1: This echo is displaying all the ingame chat to #mta with the IRCConnection stored in pIRC


function ChatToIRC( message, type )
	if (type == 0) then -- Its an normal chatmessage
		ircMessage( pIRC, "#mta", "CHAT:�� " .. getClientName( source ) .. ": " .. message )
	elseif (type == 1) then -- Its an action
		ircMessage( pIRC, "#mta", "ACTION: " .. getClientName( source ) .. ": " .. message )
	elseif (type == 2) then -- Teamchat message
		ircMessage( pIRC, "#mta", "TEAMCHAT: " .. getClientName( source ) .. ": " .. message )
	end
end

addEventHandler( "onPlayerChat", getRootElement(), ChatToIRC )

See also