:OpInterCom v4: | Mainchat Op chat
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

:OpInterCom v4: | Mainchat Op chat

Started by Herodes, 11 September, 2006, 11:33:04

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Herodes

This allows Operators to chat in the mainchat while others can't see,... It is an old script of mine I revamped in the weekend
--- OpInterCom v4
--- by Herodes
--------- --------- --------- --------- --------- --------- ---------
--- Provides an easy way to communicate in the main chat for operators ...
--- Who needs OpChat when you have InterCom ... lol
--- Just type: " [-]  " in the MainChat ...
--- Note : You DO need the ' [-] ' .. :)
--------- --------- --------- --------- --------- --------- ---------
--- 10 / 8 - 2004
--- added ' [+] ' for going into permanent OpsOnly mode..
--- added ' [=] ' for going out of OpsOnly mode...
--- added ' [?] ' for listing the Ops in OpsOnly mode...
--------- --------- --------- --------- --------- --------- ---------
--- 2 / 3 - 2005
--- converted to Lua 5 for the latest PtokaX
--------- --------- --------- --------- --------- --------- ---------
--- 15 / 3 - 2005
--- added right-click menu ( request by AMediaMan )
--------- --------- --------- --------- --------- --------- ---------
--- 28/3 - 2005
--- changed [-] mode switches does the inverse than your mode ( OpsOnly -> Normal and reverse )
--- added [!]    to talk to a single person ;) ( request by TimeTraveler )
--------- --------- --------- --------- --------- --------- ---------
--- 11/9 - 2006
--- changed the structure of the script
--- made it compatible for latest PtokaX
--- Using Lua 5.1.1
--------- --------- --------- --------- --------- --------- ---------

tCops = {}
--&#124|
function OpConnected(user)
	if user.bUserCommand then
		user:SendData("$UserCommand 1 3 :InterCom:\\OpsOnly Mode\\ON$<%[mynick]> [+]&#124")
		user:SendData("$UserCommand 1 3 :InterCom:\\OpsOnly Mode\\OFF$<%[mynick]> [=]&#124")
		user:SendData("$UserCommand 1 3 :InterCom:\\OpsOnly Msg$<%[mynick]> [-]%[line:Enter your msg here:]&#124")
		user:SendData("$UserCommand 1 2 :InterCom:\\WhisperToUser$<%[mynick]> [!] %[nick] %[line:Enter your msg here:]&#124")
		user:SendData("$UserCommand 1 3 :InterCom:\\List OpsOnly Opers$<%[mynick]> [?]&#124")
		user:SendData(":InterCom-[v4]:", "Rightclick menu for InterCom[v4] is available...")
	end
end

function ChatArrival ( oper, msg )
	if ( oper.bOperator ) then
		local s, e, txt = string.find(msg, "%b<>%s+(.+)")
		tActions = {
			['[-]'] = function ( oper, data )
				if (tCops[oper.sName] == 1) then
					SendToAll( oper.sName, data );
				elseif ( not tCops[oper.sName] ) then
					SendToOps('OpsOnly', '['..oper.sName..'] '..data )
				end
				return 1;
			end,
			['[!]'] = function( oper, data )
				local who, what = string.match( data, "%s*(%S*)%s*(.*)" )
				local w = GetItemByName(who)
				if w then
					w:SendData('Whisper from '..oper.sName..': '..what )
					oper:SendData('Whispered to '..who..': '..what)
				else
					oper:SendData('There is no user named '..who..',... try again.' )
				end
				return 1;
			end,
			['[+]'] = function ( oper )
				if (tCops[oper.sName] == 1) then
					oper:SendData("OpsOnly", "You are in OpsOnly mode already...")
				elseif ( not tCops[oper.sName] ) then
					tCops[oper.sName] = 1
					oper:SendData("OpsOnly", "You are in OpsOnly mode now ... to go into normal type ' [=] ' ")
					SendToOps("OpsOnly", "*** "..oper.sName.." went into OpsOnly mode...")
				end
				return 1;
			end,
			['[=]'] = function ( oper )
				if ( not tCops[oper.sName] ) then
					oper:SendData("OpsOnly", "You were not in OpsOnly mode ...")
				elseif (tCops[oper.sName] == 1) then
					tCops[oper.sName] = nil
					oper:SendData("OpsOnly", "You are in normal mainchat mode now ... be carefull!!!")
					SendToOps("OpsOnly", "*** "..oper.sName.." is in normal chat mode now")
				end
				return 1;
			end,
			['[?]'] = function ( oper )
				local msg = ''
				for name, v in pairs( tCops ) do
					msg = '\r\n\t     - '..name..msg
				end
				if msg == '' then
					msg = " None are in OpsOnly mode..."
				else
					msg = "\r\n\t Operators in OpsOnly Mainchat mode :"..msg
				end;
				oper:SendData("OpsOnly", msg )
				return 1;
			end,
		}
		local threefirst = string.sub( txt, 1, 3 )
		if tActions[threefirst] then
			return tActions[threefirst]( oper, string.sub( txt, 4 ) )
		else
			if tCops[oper.sName] then
				SendToOps( 'OpsOnly', '['..oper.sName..'] '..txt )
				return 1
			end
		end
	end
end

SMF spam blocked by CleanTalk