Author Topic: Can someone convert Cmd Report 1.0 for API II  (Read 2714 times)

0 Members and 1 Guest are viewing this topic.

Offline ThugLife

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Can someone convert Cmd Report 1.0 for API II
« on: 08 February, 2008, 11:27:08 »
--[[
   CmdReport 1.0 LUA 5.1
   
   By American Idiot                03/18/06
   Requested by Mikey
   
   Reports command usage to specified nicks
   Option to exclude certain nicks from check.

]]--

--Script Configuration
CsCfg = {
   Bot = "PtokaX",      -- Bot name
   Desc = "Command report",    -- Bot description
   Mail = "help@domain.com",   -- Bot email address
   ReportTo = {         -- Report to these
      ["Still_Ballin`"] = "main",      -- Nicks = Message type
      Sh0rTy = "main",
   },
   Exclude = {         -- Exclude these Nicks from check
      American Idiot = 1,      -- Nick = 1,
      YourNick = 1,
   },
}

Main = function()
   frmHub:RegBot(CsCfg.Bot, 1, CsCfg.Desc, CsCfg.Mail)
   SendToAll(frmHub:GetPrefixes())
end

ChatArrival = function(user,data)
   if not CsCfg.Exclude[user.sName] then
      local msgtype = "Main chat"
      local s,e,to = string.find(data,"^$To:%s(%S+)%s+From:")
      local s,e, pre = string.find(data,"%b<>%s(%p)")
      local s,e,cmd = string.find(data,"%b<>%s%p(%S+)")
      local s,e,msg = string.find(data,"%b<>%s%p%w+%s(.+)|$")
      if not msg then msg = "" end
      if to then msgtype = "Private Message" end
      if pre and cmd then
         for i,v in pairs(frmHub:GetPrefixes()) do
                 if pre == v then
                         cmd = pre..cmd
               local reply = "The user "..user.sName.." sent the command "..
               "in "..msgtype.." -> "..cmd.." "..msg
               for i,v in pairs(CsCfg.ReportTo) do
                  local usr = GetItemByName(i)
                  if usr then
                     if v == "pm" then
                        usr:SendPM(CsCfg.Bot,reply)
                     else
                        usr:SendData(CsCfg.Bot,reply)
                     end
                  end
               end
               break
            end
         end
      end
   end
end
ToArrival = ChatArrival
Skype: galin93

PtokaX forum

Can someone convert Cmd Report 1.0 for API II
« on: 08 February, 2008, 11:27:08 »

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

PtokaX forum

Re: Can someone convert Cmd Report 1.0 for API II
« Reply #1 on: 08 February, 2008, 18:00:48 »