Author Topic: Lua access...  (Read 1700 times)

0 Members and 1 Guest are viewing this topic.

Offline Flow84

  • Junior Member
  • **
  • Posts: 17
  • Karma: +0/-0
Lua access...
« on: 08 July, 2004, 15:51:57 »
Hi.

Have some questions related to Lua scripts in DCDM++0.029.. (and other clients)

Is it possible to get the following fields to the lua script?? If. How?


      Description
      IP
      Tag
      Connection Type
      Status
      ISP
      SPEED
      Cheating Description


Is it Possible to call the command "/startchecking 1200000" or "/away" from a lua script??

and last.. but not less importent...
is it possible to change my own:

      Connection Type
      Description
      Status
      Tag (Version it says dc++ 0.401 all the time; Slots to 2 or 4)


PtokaX forum

Lua access...
« on: 08 July, 2004, 15:51:57 »

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #1 on: 08 July, 2004, 17:03:34 »
Quote
Originally posted by Flow84
Hi.

Have some questions related to Lua scripts in DCDM++0.029.. (and other clients)

Is it possible to get the following fields to the lua script?? If. How?


      Description
      IP
      Tag
      Connection Type
      Status
      ISP
      SPEED
      Cheating Description
the myinfostring is availeble, from that info you can grab the tag/connection type/status.
the rest isn't posible i think, not sure here and it might change in the future.

Quote
Originally posted by Flow84 Is it Possible to call the command "/startchecking 1200000" or "/away" from a lua script??
no you can't trigger those commands but /away can be made in in scripted form 2.
beside this you can make your own /commands.

Quote
Originally posted by Flow84 and last.. but not less importent...
is it possible to change my own:

      Connection Type
      Description
      Status
      Tag (Version it says dc++ 0.401 all the time; Slots to 2 or 4)
again a no.
and personaly i can't really see the need for this.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Offline Flow84

  • Junior Member
  • **
  • Posts: 17
  • Karma: +0/-0
(No subject)
« Reply #2 on: 08 July, 2004, 18:16:52 »
Hi. thanks for your fast answer. :)

Quote
the myinfostring is availeble, from that info you can grab the tag/connection type/status.


how do i do that?

Quote
and personaly i can't really see the need for this.


if you want to run it like a bot its useful..

Connection Type = "BOT"
Description = "type of bot"
Status = dont know all values.. maybe not so useful..
Version in Tag = "Dont want to show this.. possible security risk"
Slots in Tag = "more neat if it could show 0"

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #3 on: 09 July, 2004, 00:34:05 »
Quote
Originally posted by Flow84
Hi. thanks for your fast answer. :)

Quote
the myinfostring is availeble, from that info you can grab the tag/connection type/status.


how do i do that?

here's a old script i made 2 try sutch kind of thing, it kicks clients older then 0.304.
Code: [Select]
--// vim:ts=4:sw=4:noet
--//
--// the second argument decides in which order the scripts are run
--// use numbers when you need order, else you can just use a _unique_ identifier

VersionTable = {}

dcpp:setListener( "info", "minver",
function( hub, user, msg )
DC():PrintDebug(user:getNick().." from minversion script")
      --if user:isOp() == nil then
      local tmp = hub:getOpList()
      if tmp[user:getNick()] == nil then
         if VersionTable[user:getNick()] then
            VersionTable[user:getNick()] = VersionTable[user:getNick()] +1
                  DC():PrintDebug("username: "..user:getNick().."  number stored: "..VersionTable[user:getNick()])
            if VersionTable[user:getNick()] >= 2 then
               local s,e,tag=string.find(msg, "(%b<>)%$")
               DC():PrintDebug("tag: "..tag)
               local s,e,version=string.find(tag, "<%+%+%sV:([%d%.]+)")
               DC():PrintDebug("version: "..version)
               if tonumber(version) < 0.304 then
                  hub:sendChat("!kickuser "..user:getNick().." update your client")
               end
            end
         else
            VersionTable[user:getNick()]=1
            DC():PrintDebug(user:getNick().."   "..VersionTable[user:getNick()])
         end
      else
               DC():PrintDebug(user:getNick().." is a op")
      end
end
)

dcpp:setListener( "info", "onquit",
function( hub, user, msg )
DC():PrintDebug(user:getNick().." from minversion script, on quit part")
      if VersionTable[user:getNick()] then
         if VersionTable[user:getNick()] >= 2 then
            VersionTable[user:getNick()] = nil
            DC():PrintDebug(user:getNick().." removed from the table cause he left")
         else
            DC():PrintDebug(user:getNick().." funny stuff")
         end
      end
   end
)

Quote
Originally posted by Flow84 if you want to run it like a bot its useful..

Connection Type = "BOT"
Description = "type of bot"
Status = dont know all values.. maybe not so useful..
Version in Tag = "Dont want to show this.. possible security risk"
Slots in Tag = "more neat if it could show 0"
a good hub kicks you for those connection types or weird versions.
don't share anything with BCDC/DCDM solves the 0 slots, no share nothing 2 download.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

PtokaX forum

(No subject)
« Reply #3 on: 09 July, 2004, 00:34:05 »