PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Cid on 02 March, 2005, 17:25:38

Title: Regged Users Download only
Post by: Cid on 02 March, 2005, 17:25:38
Someone can make it work with new PtokaX, please?
Thanks in advance ;)

-- GLOBAL VARIABLES --  make changes here only
----------------------
smDebugging       = "0"   -- Default is "0" (silent mode). "1" sends msgs to OPs
smBlockSearches   = "0"   -- Default is "1" (do not block searches)
smBlockSearchExceptions = { "Homer", "Simpson" }
----------------------------------
-- Do not change anything below --
----------------------------------
smScriptVersion = "01"
smBot = frmHub:GetHubBotName() -- This line gets bot name from PtokaX hubsoftware;
                               -- therefore, your Hub Bot should be enabled.

ToBlock = { "^$ConnectToMe%s(%S+)", "^$RevConnectToMe%s(%S+)", "^$Search%s(%S+)"}

--// This function is called when hub or script starts
function Main()
  frmHub:EnableFullData(1)
  frmHub:UnregBot(smBot)
  frmHub:RegBot(smBot)
  --// If thus configured, remove search from blocking table:
  if smBlockSearches == "0" then
    for i,v in ToBlock do
      if v == "^$Search%s(%S+)" then ToBlock = nil end
    end
  end
end

function DataArrival (user, data)
  for _,blockstring in ToBlock do
    local _, _, who = strfind(data, blockstring)
    if who then return smBlock(user,data,who) end
  end
end

function smBlock(user,data,who)
  local report
  local profnam = GetProfileName(user.iProfile)
  if profnam then
    profnam = strlower(profnam)
  else
    profnam = "alien"
  end
--// Activity by Masters, OPs, VIPs and REGs are just reported to OPs:
--// Also, searches pass if they are in the exception list:
  if (user.iProfile ~= -1) or smMatchException(data) then
    report = "\t"..user.sName.." ("..profnam..") sends:\r\n\t"..data
    smDebugToOPs(report)
    return nil
  end
--// Alien (not registered) users get blocked:
  local report = "\tBlocked from "..user.sName.." ("..
        profnam.."):\r\n\t"..data
  smDebugToOPs(report)
  return 1
end

function smMatchException(data)
  if strfind (data, "^$Search%s(%S+)") then
    for _,exceptword in smBlockSearchExceptions do
      if strfind (strlower(data), strlower(exceptword)) then
        return 1
      end
    end
  end
  return nil
end

function smDebugToOPs(data)
  if smDebugging == "1" then
    SendToOps(smBot,data)
  end
end

Title: maybe ..
Post by: UwV on 03 March, 2005, 01:48:50
well
this one does what you want
-- link--  (http://board.univ-angers.fr/thread.php?boardid=28&styleid=1&threadid=3673)
.. exept the reports ..
but it sends a pm in main to the blocked user .. and with a little edit  a "message blocked by bot" reply in the window of the  pm that got blocked..
maybe try that one ?