Gag, ungag, showgag script
 

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

Gag, ungag, showgag script

Started by Zigurds, 03 March, 2005, 21:44:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zigurds

work

code-----------------------------------------

---------------------------------------------------------------------------------------------------------------------
--   MUTE
--cmd gag work to cmd ungag
---------------------------------------------------------------------------------------------------------------------

sBot = "-MUTE-"

MUTE = {}

function ChatArrival(user, data)

   if (string.sub(data,1,1) == "<") then
   data=string.sub(data,1,string.len(data)-1)
   s,e,cmd = string.find(data,"%b<>%s+(%S+)")
      if ((cmd=="+gag")) and user.bOperator then
         DoMute(user, data) return 1

   elseif cmd == "+showgag" and user.bOperator then
      function MUTED()
      local disp = ""
         for index, value in MUTE do
         local line = index
         disp = disp.."\t ? "..line.."\r\n"
         end
         return disp
         end
      user:SendPM(sBot,"\r\n\r\n\t\t\t\t\t(? ?.??.->   These are the muted   <-.??.???)\r\n\r\n"..MUTED().."|")
      return 1
         
      elseif ((cmd=="+ungag")) and user.bOperator then
         DoUnMute(user, data) return 1
      end
      if string.sub(data,1,1) == "<" then
         if MUTE[user.sName] == 1 then return 1
         end
      end
   end
end

function DoMute(user, data)
local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local victim = GetItemByName(vic)
   if victim == nil then
      user:SendData(sBot,"User is not in the hub...")
   else
      if MUTE[victim.sName] == nil then
         MUTE[victim.sName] = 1
         SendToAll(sBot,"He, he "..victim.sName..", you txt not speak ;)")
      end
   end
end

function DoUnMute(user, data)
local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local victim = GetItemByName(vic)
   if victim == nil then
      user:SendData(sBot,"User is not in the hub...")
   else
      if MUTE[victim.sName] == 1 then
         MUTE[victim.sName] = nil;
         SendToAll(sBot, victim.sName.." you txt allow speak ;) ")
      end
   end
end

ConejoDelMal

Can someone add a profile protection to this script?

Like, Op's can be immune, and vip's can only gag reg/unreg
Rede-DC Comunidade Portuguesa de DC

jiten

#2
Something like this?
--------------------------------------------------------------------------------------------------------------------- 
-- Mute script
-- changed a bit by jiten
--------------------------------------------------------------------------------------------------------------------- 

sBot = "-MUTE-" 

tMute = {} 

AllowedProfiles = {
--	[Gagger Profile Number] = {
--		[Gagged Profile Number] = 0 --> can't gag victim; 1 --> can gag victim
--	},

	[1] = { [1] = 1, [2] = 1, [3] = 1, [4] = 0, [5] = 0, [0] = 0, [-1] = 1, },
	[2] = { [1] = 0, [2] = 1, [3] = 1, [4] = 0, [5] = 0, [0] = 0, [-1] = 1, },
	[4] = { [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 0, [0] = 0, [-1] = 1, },
	[5] = { [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1, [0] = 1, [-1] = 1, },
	[0] = { [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 0, [0] = 1, [-1] = 1, },
}

function ChatArrival(user, data) 
	local data=string.sub(data,1,-2) 
	local s,e,cmd = string.find(data,"%b<>%s+(%S+)") 
	if AllowedProfiles[user.iProfile] or user.bOperator then
		if ((cmd=="+gag")) then 
			DoMute(user, data) return 1 
		elseif cmd == "+showgag" then 
			local disp = "" 
			for index, value in tMute do 
				local line = index 
				disp = disp.."\t ? "..line.."\r\n" 
			end 
			user:SendPM(sBot,"\r\n\r\n\t\t\t\t\t(? ?.??.-> These are the muted <-.??.???)\r\n\r\n"..disp.."|") 
			return 1 
		elseif ((cmd=="+ungag")) then 
			DoUnMute(user, data) return 1 
		end 
	end
	if tMute[user.sName] == 1 then return 1 end 
end 

function DoMute(user, data) 
	local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)") 
	local victim = GetItemByName(vic) 
	if victim == nil then 
		user:SendData(sBot,"User is not in the hub...") 
	else 
		if AllowedProfiles[user.iProfile][victim.iProfile] == 1 then
			if tMute[victim.sName] == nil then 
				tMute[victim.sName] = 1 
				SendToAll(sBot,"He, he "..victim.sName..", you txt not speak ;)") 
			end
		else
			if not victim.bRegistered then
				user:SendData(sBot,"*** Error: You can't gag Users!")
			else
				user:SendData(sBot,"*** Error: You can't gag "..GetProfileName(victim.iProfile).."s!")				
			end
		end 
	end 
end 

function DoUnMute(user, data) 
	local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)") 
	local victim = GetItemByName(vic) 
	if victim == nil then 
		user:SendData(sBot,"User is not in the hub...") 
	else 
		if tMute[victim.sName] == 1 then 
			tMute[victim.sName] = nil; 
			SendToAll(sBot, victim.sName.." you txt allow speak ;) ") 
		end 
	end 
end

ConejoDelMal

#3
well, it looks exactly what i asked for :P

Thx a lot, and once again jiten  :]

I will try it out...

*edited*

Tried it now... it works great, but the immune profiles table doesnt makes much sense...if i make a profile immune, the script wont work on it, and the user anyway gets gagged by ptokax inbuilt cmd's, thats why i had so much trouble trying to make it on my own...

but thx a lot, with the allowed profile table its just perfect
Rede-DC Comunidade Portuguesa de DC

jiten

QuoteOriginally posted by [AT]conejodelmal
well, it looks exactly what i asked for :P

Thx a lot, and once again jiten  :]

I will try it out...

*edited*

Tried it now... it works great, but the immune profiles table doesnt makes much sense...if i make a profile immune, the script wont work on it, and the user anyway gets gagged by ptokax inbuilt cmd's, thats why i had so much trouble trying to make it on my own...

but thx a lot, with the allowed profile table its just perfect
That was exactly my doubt when I was editing the script.
It's way better to use only the AllowedProfile table as it really doesn't make sense :D
So, I updated the first script with something more logical.

Cheers

ConejoDelMal

Its just perfect, thx again
Rede-DC Comunidade Portuguesa de DC

SMF spam blocked by CleanTalk