PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Pedro on 19 January, 2004, 17:07:30

Title: REQ: sharechecker that redirects
Post by: Pedro on 19 January, 2004, 17:07:30
looking for a sharechecker that will redirect users and not disconnect them..

I am OP on a network of hubs and want users redirected to our other hubs if share or slots/hub not met.

I know this can be done, I just dont know how to..maybe someone can recommend good book for learning lua code..

HAPPY DAYS
Title:
Post by: Pedro on 19 January, 2004, 19:36:59
okay I had me a read of some scripts and came up with this..

botname = "??Command??"
minShareGB = 1

red = frmHub:GetRedirectAddress()

kb = 1024
mb = kb*kb
gb = kb*kb*kb
minShare = minShareGB * gb

function NewUserConnected(user)
   local t = tokenize(user.sMyInfoString,"$")
   local num = t[getn(t)]

   if tonumber( num ) < minShare then
    user:SendPM( botname, "You have not reached to the minimum share amount "..minShareGB.."GB  |$ForceMove "..red.."|")
         curUser:Disconnect()
     end
  end

function tokenize (inString,token)
_WORDS = {}
local matcher = "([^"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end


anyone want to correct me on this