PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: witch on 08 August, 2004, 00:12:12

Title: Anti Modem Bot
Post by: witch on 08 August, 2004, 00:12:12
Hi guys!
I use this script for stoping modem users come on the hub, working fine!

------------------------------------------------------------------------------------------------------------------------------------------------


BotName = "KillModem"

function NewUserConnected(curUser)
    data=curUser.sMyInfoString
    s,e,cmd = strfind( data, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" )

if (strfind(cmd,"28.8K")) then
curUser:SendPM(BotName,"no28.8 modem allowed in here ...")
curUser:Disconnect()
end
if (strfind(cmd,"33.6K")) then
curUser:SendPM(BotName,"no 33.6k modem allowed in here ...")
curUser:Disconnect()
end
if (strfind(cmd,"56K")) then
curUser:SendPM(BotName,"no 56k modem allowed in here ...")
curUser:Disconnect()
end
if (strfind(cmd,"ISDN")) then
curUser:SendPM(BotName,"no ISDN allowed in here ...")
curUser:Disconnect()
end
end

------------------------------------------------------------------------------------------------------------------------------------------------

But as soon is user inside the hub he can change it to modem on general settings of them client with out any problem, and still stays on the hub. So any sugestions how can i stop it?

Thanx
Title:
Post by: plop on 08 August, 2004, 00:55:50
try this 1.
optimized it a bit also.
BotName = "KillModem"

function NewUserConnected(curUser)
   data=curUser.sMyInfoString
   s,e,cmd = strfind( data, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" )

   if (strfind(cmd,"28.8K")) then
      curUser:SendPM(BotName,"no28.8 modem allowed in here ...")
      curUser:Disconnect()
   elseif (strfind(cmd,"33.6K")) then
      curUser:SendPM(BotName,"no 33.6k modem allowed in here ...")
      curUser:Disconnect()
   elseif (strfind(cmd,"56K")) then
      curUser:SendPM(BotName,"no 56k modem allowed in here ...")
      curUser:Disconnect()
   elseif (strfind(cmd,"ISDN")) then
      curUser:SendPM(BotName,"no ISDN allowed in here ...")
      curUser:Disconnect()
   end
end

function DataArrival(curUser, data)
   if curUser.bOperator == nil then
      NewUserConnected(curUser)
   end
end

plop
Title:
Post by: witch on 08 August, 2004, 01:08:24
Thanx dude! Now it's working much better, all my cheaters was kicked off :))
Title:
Post by: witch on 08 August, 2004, 01:21:08
oooooooooopssss......i was too quick with answer:

Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
   1:  function `strfind' [C]
   2:  function `NewUserConnected' at line 9 [file `D:\PtokaX\NEW\scripts\modem.lua']
   3:  function `DataArrival' at line 47 [file `D:\PtokaX\NEW\scripts\modem.lua']
Title:
Post by: BeeR on 08 August, 2004, 03:19:11
QuoteOriginally posted by plop
try this 1.
optimized it a bit also.
BotName = "KillModem"

function NewUserConnected(curUser)
   data=curUser.sMyInfoString
   s,e,cmd = strfind( data, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" )

   if (strfind(cmd,"28.8K")) then
      curUser:SendPM(BotName,"no28.8 modem allowed in here ...")
      curUser:Disconnect()
   elseif (strfind(cmd,"33.6K")) then
      curUser:SendPM(BotName,"no 33.6k modem allowed in here ...")
      curUser:Disconnect()
   elseif (strfind(cmd,"56K")) then
      curUser:SendPM(BotName,"no 56k modem allowed in here ...")
      curUser:Disconnect()
   elseif (strfind(cmd,"ISDN")) then
      curUser:SendPM(BotName,"no ISDN allowed in here ...")
      curUser:Disconnect()
   end
end

function DataArrival(curUser, data)
   if curUser.bOperator == nil then
      NewUserConnected(curUser)
   end
end

plop

Hello Mr Plop :]

can you change all disconnect to: read rd adress from the hub insted??

Best Regards
Title:
Post by: plop on 08 August, 2004, 04:31:07
this should be fixed now witch, but as you might see i optimized it a bit more.
this could cause a new bug but i'm not expecting them.

beer if you change the 1 behind disconnect to a nil it should start 2 redirect.
but only on old clients as this feature has been removed on the latest dc++ versions.
-- no modem
-- original by ....... (no idea)
-- optimized and redirect option added by plop

BotName = "KillModem"
-- use any vallue to use the disconnect, and "nil" to make it redirect.
disconnect = 1

tBadCon = {
   ["ISDN"] = 1,
   ["56Kbps"] = 1,
   ["33.6Kbps"] = 1,
   ["28.8Kbps"] = 1
}

function NewUserConnected(curUser)
   if curUser.sMyInfoString then
      local s,e,cmd = strfind(curUser.sMyInfoString, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" )
      if cmd then
         cmd = strsub(cmd, 1,-2)
         if tBadCon[cmd] then
            curUser:SendPM(BotName,"no "..cmd.." modem allowed in here ...")
            if disconnect then
               curUser:Disconnect()
            else
               curUser:SendData(" You are being redirected ... |$ForceMove "..frmHub:GetRedirectAddress().."|")
            end
         end
      end
   end
end

function DataArrival(curUser, data)
   if curUser.bOperator == nil then
      NewUserConnected(curUser)
   end
end

plop
Title:
Post by: witch on 08 August, 2004, 12:37:07
Much better now! Thanx Plop dude  :P
Title:
Post by: Herodes on 08 August, 2004, 13:01:37
Something tells me I dont like this script ... lol
Title:
Post by: witch on 08 August, 2004, 13:12:19
..don't look at it ....lol  :D  :D  :D
Title:
Post by: Herodes on 08 August, 2004, 13:21:11
I am gonna cry !!!! stupid greek communication networks are not giving a damn about getting us junkies up-to-speed ... :((((((((((((((

witch: not only I saw it ... I collect as well :D

good work plop ..
Title: other possibility
Post by: UwV on 08 August, 2004, 18:12:34
well i just wonder what is your problem with modemusers anyway ? ..
like anybody out there is happy to be a modem user ?
and would not upgrade their connection if they where able to ..  ..
just slot/hub ratio checking is much nicer ... in my opinion anyway ..
Title:
Post by: VERMiN on 08 August, 2004, 18:21:51
Just sucks when your queue consist of modem users which take up valueble d/l slot's ;-)