Modules/IRCEcho/ircIsOp: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{ModuleFunction|IRCEcho}} Can be used to check if the user has Op or higher ==Syntax== <syntaxhighlight lang="lua"> function ircIsOp ( IRCConnection irc, string channel, string nick ) </syntaxhighlight>...)
 
No edit summary
Line 18: Line 18:
   if string.find( szText, "!kick" ) == 1 then
   if string.find( szText, "!kick" ) == 1 then
if ( ircIsOp( pIRC, '#mta', szNick ) ) then
if ( ircIsOp( pIRC, '#mta', szNick ) ) then
  local thePlayer = getPlayerFromNick(string.sub(szText, 5))
  local thePlayer = getPlayerFromNick(string.sub(szText, 6))
  if (thePlayer) then
  if (thePlayer) then
kickPlayer( thePlayer )
kickPlayer( thePlayer )

Revision as of 19:11, 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 Op or higher

Syntax

function ircIsOp ( 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 op or higher can use !kick

function irc_onPrivMsg( szChannel, szNick, szText )
  	if string.find( szText, "!kick" ) == 1 then
		if ( ircIsOp( pIRC, '#mta', szNick ) ) then
		  	local thePlayer = getPlayerFromNick(string.sub(szText, 6))
		  	if (thePlayer) then
				kickPlayer( thePlayer )
			end
		end
	end
end