PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: kunal on 19 October, 2005, 19:01:21

Title: Conversion req
Post by: kunal on 19 October, 2005, 19:01:21
someone convert me this script
-- Mute Script v0.3
-- By Kepp
-- 04/02/18
-- added a timer function that clears the table // Typhoon? / Ratcom_Typhoon?
-- +mute
-- +unmute
-- works agaist reconnect and the use of !me
-- +showmuted added by Typhoon? / Ratcom_Typhoon?
-- thx to kepp & plop  :-?

------------ things that can be changed

sBot = "[MUTER]"
ClockInterval = 5   -- clears table on specific minutes

----------- End

MUTE = {}
mins = 1000 * 60 * ClockInterval

function Main()
SetTimer(mins)
StartTimer()
end

function OnTimer()
clear()
end

function clear()
MUTE = nil
MUTE = {}
end

function DataArrival(user, data)
   if (strsub(data,1,1) == "<") then
  data=strsub(data,1,strlen(data)-1)
    s,e,cmd = strfind(data,"%b<>%s+(%S+)")
   end

      if cmd == "+mute" and user.bOperator then
  DoMute(user, data) return 1
         
elseif cmd == "+showmuted" 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 == "+unmute" and user.bOperator then
  DoUnMute(user, data) return 1
      end
      if strsub(data,1,1) == "<" then
         if MUTE[user.sName] == 1 then return 1
         end
      end
   end


function DoMute(user, data)
local s,e,cmd,vic = strfind(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,"Tell me "..victim.sName..", How good is a phonecall if you're unable to speak? ;)")
      end
   end
end

function DoUnMute(user, data)
local s,e,cmd,vic = strfind(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.." Was umuted ;) ")
      end
   end
end
j
Title: Here it is...
Post by: Markitos on 19 October, 2005, 23:22:21
-- Mute Script v0.3

-- By Kepp

-- 04/02/18

-- added a timer function that clears the table // Typhoon? / Ratcom_Typhoon?

-- +mute

-- +unmute

-- works agaist reconnect and the use of !me

-- +showmuted added by Typhoon? / Ratcom_Typhoon?

-- thx to kepp & plop  :-?

-- Converted to lua 5 by Markitos 19/10/05



------------ things that can be changed



sBot = "[MUTER]"

ClockInterval = 5   -- clears table on specific minutes



----------- End



MUTE = {}

mins = 1000 * 60 * ClockInterval



function Main()

SetTimer(mins)

StartTimer()

end



function OnTimer()

clear()

end



function clear()

MUTE = nil

MUTE = {}

end



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+)")

   end



      if cmd == "+mute" and user.bOperator then

  DoMute(user, data) return 1

         
elseif cmd == "+showmuted" 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 == "+unmute" 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





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,"Tell me "..victim.sName..", How good is a phonecall if you're unable to 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.." Was umuted ;) ")

      end

   end

end

Cheers...
Title:
Post by: kunal on 20 October, 2005, 16:53:08
thank you :))
Title:
Post by: Markitos on 20 October, 2005, 19:15:05
QuoteOriginally posted by kunal
thank you :))
Ur welcome!