Hi there, i think i have here a script conflit or something..
I have these scripts running..
-----------------------------------------------------------------------------
-- online user counter by plop v:1.2
-- based on a bot by ....... witch showed basic hub info 2 users on entry
-- (fill in the name pls if you know who this was)
-----------------------------------------------------------------------------
-- LEVELSTOT[number] = total number of users with that level
-- LEVELS[number] = total online number of users with that level
-- commands = table of triggers used by the hub 2 add/delete users
-- add the script commands yourself if you use a script 2 add/delete users
-- same can be done if you have more user levels then default
-----------------------------------------------------------------------------
-- tables all over but i seem 2 have forgotten 2 add chairs. snif snif
-----------------------------------------------------------------------------
-- manual stuff
-----------------------------------------------------------------------------
-- LEVELSTOT["0"] -- total masters
-- LEVELSTOT["1"] -- total operators
-- LEVELSTOT["2"] -- total VIPs
-- LEVELSTOT["3"] -- total registred users
-- tmp -- total operators and masters
-- frmHub:GetUsersCount() -- total online users
----------
-- LEVELS["0"] -- total online masters
-- LEVELS["1"] -- total online operators
-- LEVELS["2"] -- total online VIPs
-- LEVELS["3"] -- total online registered users
-- LEVELS["-1"] -- total online unregistered users
-- tmp3 -- total operators and masters
----------
-- offline users
-- LEVELSTOT["0"] - LEVELS["0"] == offline operators
-- tmp1 -- total offline VIPs
-- tmp2 -- total offline registered users
-----------------------------------------------------------------------------
-- name of the bot
Bot = "[operserv]"
Multi = "[multihub]=--------------------"
-- couter tables, if you have more levels add there numbers in BOTH tables,
-- except unreg users, those only work in the lower table
LEVELSTOT = {["0"]=0, ["1"]=0, ["2"]=0, ["3"]=0}
LEVELS = {["0"]=0, ["1"]=0, ["2"]=0, ["3"]=0, ["-1"]=0}
-- table holding the commands ptokax uses 2 add/delete users
-- add your bot's commands 2 this table if you use a bot 2 add/delete ppl
commands = {["!addreguser"]=1, ["!delreguser"]=1}
function Message(user)
local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
share = format("%0.2f", ( share / (1024*1024*1024)))
local hubshare = format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
local tmp = LEVELSTOT["1"] + LEVELSTOT["0"] --- total ops (adding masters 2 ops)
local tmp1 = (LEVELSTOT["2"] - LEVELS["2"]) if tmp1 < 0 then tmp1 = 0 end --- offline vips (total - online)
local tmp2 = (LEVELSTOT["3"] - LEVELS["3"]) if tmp2 < 0 then tmp2 = 0 end --- offline regs (total - online)
local tmp3 = LEVELS["1"] + LEVELS["0"] -- online ops (adding masters 2 the ops)
user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
user:SendData(Multi, " <----------------=[- "..frmHub:GetHubName().." v2004 -]=-")
user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
user:SendData(Bot, " ? Comunidade Lusobrasileira de ?irect C?nnect ?")
user:SendData(Bot, " ? "..user.sName..", bem vindo ao servidor.")
user:SendData(Bot, " ? Seu endere?o IP: "..user.sIP)
user:SendData(Bot, " ? Seu status no Hub: "..(GetProfileName(user.iProfile) or "N?o registrado"))
user:SendData(Bot, " ? Voc? est? compartilhando: "..share.." GB.")
user:SendData(Bot, " ? Usu?rios Online no Hub: "..frmHub:GetUsersCount()..".")
user:SendData(Bot, " ? Operadores Online no Hub: "..tmp3..". ViPs: "..LEVELS["2"]..".")
user:SendData(Bot, " ? Total de Operadores registrados no Hub: "..tmp..". ViPs: "..LEVELSTOT["2"]..".")
user:SendData(Bot, " ? Usu?rios registrados n?o conectados: "..tmp2..".")
user:SendData(Bot, " ? Compartilhamento atual no Hub: "..hubshare.." GB.")
user:SendData(Bot, " ? Lista de comandos, regras, ajuda e informa??o: !ajuda")
user:SendData(Bot, " ? Website: www.lusobrasil.rg3.net")
user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
user:SendData(Multi, " <----------------=[- "..frmHub:GetHubName().." v2004 -]=-")
user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
end
------------- better not 2 touch anything below here if your not sure what your your doing
ALLUSERS={}
function NewUserConnected(user)
if ALLUSERS[user.sName]==nil then
ALLUSERS[user.sName]=1
LEVELS[tostring(user.iProfile)]=LEVELS[tostring(user.iProfile)]+1
end
Message(user)
end
function OpConnected(user)
if ALLUSERS[user.sName]==nil then
ALLUSERS[user.sName]=1
LEVELS[tostring(user.iProfile)]=LEVELS[tostring(user.iProfile)]+1
end
Message(user)
end
function DataArrival(user, data)
if ALLUSERS[user.sName]==nil then
ALLUSERS[user.sName]=1
LEVELS[tostring(user.iProfile)]=LEVELS[tostring(user.iProfile)]+1
end
s,e,cmd= strfind(data, "%b<>%s+(%S+)")
if cmd ~= nil and commands[cmd] then
SetTimer(5 * 1000)
StartTimer()
end
end
function OnTimer()
StopTimer()
OpenRegisterdUsersFile()
end
function UserDisconnected(user)
if ALLUSERS[user.sName] then
ALLUSERS[user.sName]=nil
if LEVELS[tostring(user.iProfile)] > 0 then
LEVELS[tostring(user.iProfile)]=LEVELS[tostring(user.iProfile)]-1
end
end
end
function OpDisconnected(user)
if ALLUSERS[user.sName] then
ALLUSERS[user.sName]=nil
if LEVELS[tostring(user.iProfile)] > 0 then
LEVELS[tostring(user.iProfile)]=LEVELS[tostring(user.iProfile)]-1
end
end
end
function Main()
frmHub:RegBot(Bot)
OpenRegisterdUsersFile()
end
function OpenRegisterdUsersFile()
readfrom("../RegisteredUsers.dat")
for a,b in LEVELSTOT do
LEVELSTOT[a]=0
end
while 1 do
local line = read()
local level
if line == nil then
readfrom()
break
end
s,e,level = strfind(line,".+|.+|(.+)")
if LEVELSTOT[level] then
LEVELSTOT[level] = LEVELSTOT[level] +1
end
end
end
And this one..
-- easyranger
-- tezlo
BotName = "[operserv]"
ipRanges = {}
denyMsg = "<[operserv]> IP-Range tempor?riamente banido no LusoBrasil Hub, d?vidas informe --> lusobrasil@netcabo.pt"
function compute(ip)
local s, e, a, b, c, d = strfind(ip, "^(%d+).(%d+).(%d+).(%d+)$")
if s then return a*16777216 + b*65536 + c*256 + d end return 0
end
function checkrange(table, ip)
return foreachi(table, function(id, tmp)
if (%ip >= tmp[1]) and (%ip <= tmp[2]) then return tmp end
end)
end
function load(name, data)
ipRanges[name] = ipRanges[name] or {}
gsub(data, "(%S+) %- (%S+)", function(s, e)
s, e = compute(s), compute(e)
tinsert(ipRanges[%name], { s, e })
end)
end
function Main()
local f = openfile("txt/ranger.dat", "r") assert(f, "txt/ranger.dat")
local file = read(f, "*a") closefile(f) gsub(file, "%[(%S+)%]([%c%d%s%-%.]+)", load)
end
function NewUserConnected(user)
if user.iProfile ~= -1 then return end
local ip, block = compute(user.sIP)
for name, range in ipRanges do
if checkrange(range, ip) then block = name break end
end if block then
SendToOps(BotName, "Usu?rio "..user.sName.." com o IP: [ "..user.sIP.." ] foi desconectado, motivo: "..block)
user:SendData(denyMsg)
user:TempBan()
end
end
Both working great, but that i have a syntax error when an user with that ipranger tries to connect :(
I think this scripts erros (syntax) are related with the function NewUserConnected(user) i think that they can't read something on user, since he got banned by iprange. don't know :\
Tks in advance, and Plop 4 Moderator Now =)
Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
1: function `strfind' [C]
2: function `Message' at line 51 [file `...\ptokax\scripts\lusobrasil.onjoin.lua']
3: function `NewUserConnected' at line 86 [file `...\ptokax\scripts\lusobrasil.onjoin.lua']
Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
1: function `strfind' [C]
2: function `NewUserConnected' at line 365 [file `C:\ptokax\scripts\lusobrasil.hub.lua']
try inserting the next on the line below NewUserConnected
if user.iProfile then
and offcourse a extra end @ the end of the function.
1 more question.
are you running the 0.3.3.0 beta???
as there is a bug in that which can cause errors like this 2 show up, but in fact the scripts work oke.
plop