----------------------------------------------------------------------------- -- 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]" -- 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+)%$") if share ~= nil then share = format("%0.2f", ( share / (1024*1024*1024))) else share = 0 end 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(Bot, " <-----=[- "..frmHub:GetHubName().." • "..GetDate().." -]=----->") user:SendData(Bot, "-=[×]=-----------------------------------------------------------------------------------------------=[×]=-") user:SendData(Bot, " • Comunidade Lusobrasileira de Ðirect Cønnect - P2P ™") 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 - Fórum: www.lusobrasil.site.vu") user:SendData(Bot, "-=[×]=-----------------------------------------------------------------------------------------------=[×]=-") user:SendData(Bot, " <-----=[- "..frmHub:GetHubName().." • "..GetDate().." -]=----->") user:SendData(Bot, "-=[×]=-----------------------------------------------------------------------------------------------=[×]=-") end ------------------------------------------------------------------------------------------------------------------------------------------------- function GetDate() d = date("%d") mm = date("%m") y = date("%y") Date = ""..d.."/"..mm.."/"..y return Date end ------------------------------------------------------------------------------------------------------------------------------------------------- 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