PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Zigurds on 03 March, 2005, 16:56:28

Title: Pleasu translate im LUA5 gagbot and nickbot
Post by: Zigurds on 03 March, 2005, 16:56:28
---------------------------------------------------------------------------------------------------------------------
--   MUTE
---------------------------------------------------------------------------------------------------------------------

sBot = "MUTESBAJAARS"

MUTE = {}

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+)")
      if ((cmd=="+gag")) and user.bOperator then
         DoMute(user, data) return 1
         
      elseif ((cmd=="+ungag")) 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
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,"Juuzeris nav hubaa...")
   else
      if MUTE[victim.sName] == nil then
         MUTE[victim.sName] = 1
         SendToAll(sBot,"Nu ko "..victim.sName..", naaksies tev kaadu laiku meeli iekost zobos ;)")
      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,"Juuzeris nav hubaa...")
   else
      if MUTE[victim.sName] == 1 then
         MUTE[victim.sName] = nil;
         SendToAll(sBot, victim.sName.." meele atbriivota ;) ")
      end
   end
end


and

--------------------------------------------------------------------------------------------------------------------
-- -NICKBOTS-   
-- Scripti nika, aizliegtu simbolu paarbaudei
-- SendPmToOps private opam
--------------------------------------------------------------------------------------------------------------------

detektors = "-DETEKTORS-"
detektiivs = "-DETEKTIIVS-"
restart = "-RESTART-"
statbots = "-STATBOTS-"


ANTIWORDS = { "?","!","*","#"}

--------------------------------------------------------
function DataArrival(curUser, data)
---------------------------------------------------------------------------------------------------------------------
--   NICKBOTS
---------------------------------------------------------------------------------------------------------------------
   if strsub(data, 1, 13) == "$ValidateNick" and curUser.bOperator == nil then
      local nick = strsub(data, 15, -2)
   else
   local nick = curUser.sName
      local aapsis = strsub(nick,1,1)
   local labs=nil
   local goodies="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
   local xxx=strlen(goodies)

   for i=1,xxx  do
      if (aapsis == strsub(goodies,i,i)) then labs=1 end
   end
----------------------------------------------------------------------------------------------------------------------
   if (labs==nil) and (curUser.sName ~= detektors ) and (curUser.sName ~= detektiivs ) and (curUser.sName ~= restart ) and (curUser.sName ~= statbots ) then
      curUser:SendPM("<-NICKBOTS->","Nikam jaasaakas ar latiinju alfabeta burtu!")
--      SendToOps("<-NICKBOTS->","*** Juuzerim <"..curUser.sName.."> IP <" ..curUser.sIP.."> niks nesaakas ar burtu! Atvienots:)")
      curUser:Disconnect()
   end
      if(strlen(curUser.sName) > 20) and curUser.iProfile == -1 then
           curUser:SendPM("<-NICKBOTS->","Niks nedriikst buut garaaks par 20 ziimeem!")
--      SendToOps("<-NICKBOTS->","*** Juuzerim <"..curUser.sName.."> IP <" ..curUser.sIP.."> niks par garu! Atvienots:)")
           curUser:Disconnect()
   end
      if(strlen(curUser.sName) < 3) and curUser.iProfile == -1 then
           curUser:SendPM("<-NICKBOTS->","Niks nedriikst buut iisaaks par 3 ziimeem!")
--      SendToOps("<-NICKBOTS->","*** Juuzerim <"..curUser.sName.."> IP <" ..curUser.sIP.."> niks par iisu! Atvienots:)")
           curUser:Disconnect()
   end
     if(strfind (curUser.sName, " ", 1, 1) ) and curUser.iProfile == -1 then
           curUser:SendPM("<-NICKBOTS->","Nikaa nedriikst atstarpes!")
--      SendToOps("<-NICKBOTS->","*** Juuzerim <"..curUser.sName.."> IP <" ..curUser.sIP.."> nikaa atstarpes! Atvienots:)")
          curUser:Disconnect()
   end
----------------------------------------------------------------------------------------------------------------------
      if (strsub(data,1,7) == "$MyINFO") and curUser.bOperator == nil then
         for i,v in ANTIWORDS do   
         Find = strlower(data)      
               if strfind(Find,v)  then                   
         curUser:SendPM("<-NICKBOTS-> ","Niks/apraksts nedriikst satureet hubsofta simbolus! Lasi FAQ")
--         SendToOps("<-NICKBOTS->","*** Juuzerim <"..curUser.sName.."> IP <" ..curUser.sIP.."> nikaa hubsofta simboli! Atvienots:)")
         curUser:Disconnect()
         do return end
         end
      end
   end
end
end


------------------------------------
Owner for Latvian hub Alfa
Title:
Post by: [UK]Madman on 03 March, 2005, 17:17:39
Done quickly and not tested.....


---------------------------------------------------------------------------------------------------------------------
-- MUTE
---------------------------------------------------------------------------------------------------------------------

sBot = "MUTESBAJAARS"

MUTE = {}

function ChatArrival(user, data)

data=string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")

if cmd=="+gag" and user.bOperator then
DoMute(user, data)
return 1

elseif cmd=="+ungag" and user.bOperator then
DoUnMute(user, data)
return 1
end

if MUTE[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,"Juuzeris nav hubaa...")

else

if MUTE[victim.sName] == nil then
MUTE[victim.sName] = 1
SendToAll(sBot,"Nu ko "..victim.sName..", naaksies tev kaadu laiku meeli iekost zobos ;)")
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,"Juuzeris nav hubaa...")

else

if MUTE[victim.sName] == 1 then
MUTE[victim.sName] = nil;
SendToAll(sBot, victim.sName.." meele atbriivota ;) ")
end
end
end

Title:
Post by: Zigurds on 03 March, 2005, 18:08:11
hm, not work :(
Title:
Post by: 6Marilyn6Manson6 on 03 March, 2005, 18:32:40
Use it

-- 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?
-- thank you to kepp & plop  :-?
-- Converted the script into LUA 5 by 6Marilyn6Manson6

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

sBot = "[MUTER]"
ClockInterval = 86400   -- clears table on specific math.minutes

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

MUTE = {}
math.mins = 1000 * 60 * ClockInterval

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

function OnTimer()
clear()
end

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

function DataArrival(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

bye bye
Title:
Post by: Zigurds on 03 March, 2005, 19:55:16
Thanks, but me collect own fix :)


Sorry my bad English
------------------------------------
Owner for Latvian hub Alfa