LUA script help

Releases and bugs in here...
yakko
Posts: 258
Joined: 2003-01-27 06:04

LUA script help

Post by yakko » 2004-12-02 19:43

We've recently had problems with people spamming our hub so I started using the AntiAdv.lua script and it's working well. Some of my ops suggested it'd be nice to know when someone is spamming rather than the messages just being dropped with no one knowing. I don't know much about programming but I took a look at a couple of other scripts that send messages to the operator channel, primarily opcomextras, to see if I could figure it out, but I can't get it to work. Can I get some pointers as to what I'm doing wrong?

Code: Select all

-- vim:ts=4:sw=4:noet
-- AntiAdv.lua -- Sedulus, 2003

local addr = {
        "newtransformers.dynip.com",
        "newtransformers.no-ip.org",
        "tfgalaxy.no-ip.org",
        "transformers4ever.dyndns.org",
        "193.182.174.183",
        "thisisatest.hub.com",
        "spacebridge",
}
local opchat_name = "-=Operators=-"     -- user onlineness alerts gets sent here

local function send( c )
        c:privateMessage( ""..nick.." is spamming - this is yakko testing", opchat_name )
end
function dchpp.clientMessage( client, msg )
        if not client:isOp() then
                for k,v in addr do
                        if string.find( msg, v, 1, 1 ) then
                                client:hubMessage( msg, client:getNick() )
                                send( c )
                                return dchpp.ACTION_STOP
                        end
                end
        end
end

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 07:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2004-12-02 20:42

From where are you getting this c you are using as argument to the send function?
And I don't think you can use just nick to get the nick of the user. You do probably have to send the client object to the send function and user client:getNick() for that.

yakko
Posts: 258
Joined: 2003-01-27 06:04

Post by yakko » 2004-12-02 23:29

joakim_tosteberg wrote:From where are you getting this c you are using as argument to the send function?

I got that bit from the OpComExtra script. I was hoping to find a similar action in another script and modify it, but my lack of programming skills is evident.

Where is a good resource for LUA and Dch++?

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 14:32

Post by Sedulus » 2004-12-03 02:50

there is no unnamespaced send function either

you need something like
dchpp.foreach( function( opClient )
opClient:privateMessage( "somenick is sending something", someBotName )
end, -1 )
or something. I don't recall exactly
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

Who is online

Users browsing this forum: Google [Bot] and 0 guests