Modules/IRCEcho/ircIsHalfop: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 17: Line 17:
function irc_onPrivMsg( szChannel, szNick, szText )
function irc_onPrivMsg( szChannel, szNick, szText )
   if string.find( szText, "!asay" ) == 1 then
   if string.find( szText, "!asay" ) == 1 then
if ( ircIsHalfop( pIRC, '#mta', szNick ) ) then
if ( ircIsHalfop( pIRC, szChannel, szNick ) ) then
  local Message = string.sub(szText, 6)
  local Message = string.sub(szText, 6)
  outputChatBox("The admin says: " .. Message, getRootResource(), 255, 0, 0)
  outputChatBox("The admin says: " .. Message, getRootResource(), 255, 0, 0)

Latest revision as of 19:19, 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.

Can be used to check if the user has Halfop or higher

Syntax

function ircIsHalfop ( IRCConnection irc, string channel, string nick )

Required arguments

  • irc: The IRCConnection
  • channel: The channel that you want to check on
  • nick: The person that you want to check on

Example

Example 1: This script can be used from irc, so that people with Halfop or higher can use !asay

function irc_onPrivMsg( szChannel, szNick, szText )
  	if string.find( szText, "!asay" ) == 1 then
		if ( ircIsHalfop( pIRC, szChannel, szNick ) ) then
		  	local Message = string.sub(szText, 6)
		  	outputChatBox("The admin says: " .. Message, getRootResource(), 255, 0, 0)
		end
	end
end

See also