PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: nEgativE on 29 December, 2003, 05:41:17

Title: function showreg(user) - totals
Post by: nEgativE on 29 December, 2003, 05:41:17
Hi Plop, Hi all.. Is it possible to get total reg users and show it in this script ? :) and also current non reg users online.



Bot = "[operserv]"
ops =0
vips = 0
VIPS = {}
OPS = {}

function NewUserConnected(user)
   if user.iProfile == 2 then
      CountVips(user)
   end
   Message(user)
end

function OpConnected(user)
   CountOps(user)
   Message(user)
end

function DataArrival(user,data)
   if user.bOperator then
      CountOps(user)
   elseif user.iProfile == 2 then
      CountVips(user)
   end
end

function CountOps(user)
   if OPS[user.sName] == nil then
      OPS[user.sName]=1
      ops = ops + 1
   end
end

function CountVips(user)
   if VIPS[user.sName] == nil then
      VIPS[user.sName]=1
      vips=vips +1
   end
end

function UserDisconnected(user)
   if user.iProfile == 2 then
      if VIPS[user.sName] then
         VIPS[user.sName]=nil
         vips=vips - 1
      end
   end
end

function OpDisconnected(user)
   if OPS[user.sName] then
      OPS[user.sName]=nil
      ops = ops -1
   end
end

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)))
   user:SendData(Bot, ":p2p:-------------------------------------------------------------------------------------------------:p2p:")
   user:SendData(Bot, "     ? "..user.sName..", bem vindo ao -=[- "..frmHub:GetHubName().." -]=-")
   user:SendData(Bot, "     ? Seu endere?o IP: "..user.sIP)
   user:SendData(Bot, "     ? Website: www.lusobrasil.tk")
   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: "..frmHub:GetUsersCount()..".")
   user:SendData(Bot, "     ? Operadores Online: "..ops..", ViPs Online: "..vips..".")
   user:SendData(Bot, "     ? Compartilhamento atual no Hub: "..hubshare.." GB.")
   user:SendData(Bot, "     ? Lista de comandos, regras, ajuda e informa??o: !ajuda")
   user:SendData(Bot, "     ? Help, command list, rules and info: !ajuda.en")
   user:SendData(Bot, ":p2p:-------------------------------------------------------------------------------------------------:p2p:")
end



I saw this function in robocop, but i'm not able of do anything here !! Hehe.



function showreg(user)

local profiles = GetProfiles()
local index, profile, index2, username
local disp = ""
for index, profile in profiles do
local line = profile
disp = disp.."\r\nProfile "..line..":\r\n"
users = GetUsersByProfile(profile)
for index2, username in users do
local line = username
if GetItemByName(username) then
if (strlen(username) <= 8) then
disp = disp.." ? "..line.."\t\t? On-line ?\r\n"
else
disp = disp.." ? "..line.."\t\t? On-line ?\r\n"
end
else
if (strlen(username) <= 8) then
disp = disp.." ? "..line.."\r\n"
else
disp = disp.." ? "..line.."\r\n"
end
end
end
end
user:SendPM(sBot, "\r\n\r\n:p2p:----: Usu?rios registrados no Hub :----:p2p:\r\n"..disp)
return 1
end



Title:
Post by: plop on 29 December, 2003, 14:26:50
yep posible.
Bot = ".MeanMachineT."

--frmHub:RegBot(Bot)

ops = 0
vips = 0
users = 0
USER = {}
VIPS = {}
OPS = {}

function NewUserConnected(user)
   if user.iProfile == 2 then
      CountVips(user)
   if user.iProfile == -1 then
      CountUser(user)
   end
   Message(user)
   end
end

function OpConnected(user)
   CountOps(user)
   Message(user)
end

function DataArrival(user, data)
   if user.bOperator then
      CountOps(user)
   elseif user.iProfile == 2 then
      CountVips(user)
   elseif user.iProfile == -1 then
      CountUser(user)
   end
end

function CountOps(user)
   if OPS[user.sName] == nil then
      OPS[user.sName]=1
      ops = ops + 1
   end
end

function CountVips(user)
   if VIPS[user.sName] == nil then
      VIPS[user.sName]=1
      vips = vips + 1
   end
end

function CountUser(user)
   if USER[user.sName] == nil then
      USER[user.sName]=1
      users = users + 1
   end
end

function UserDisconnected(user)
   if user.iProfile == 2 then
      if VIPS[user.sName] then
         VIPS[user.sName]=nil
         vips = vips - 1
   elseif user.iProfile == -1 then
      if USER[user.sName] then
         USER[user.sName]=nil
         users = users - 1
      end
   end
end

function OpDisconnected(user)
   if OPS[user.sName] then
      OPS[user.sName]=nil
      ops = ops - 1
   end
end

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)))
   user:SendData(Bot, ":-------------------------------------------------------------------------------------------------------------:")
   user:SendData(Bot, "  . ."..user.sName..".")
   user:SendData(Bot, "  . Your IP: "..user.sIP)
   user:SendData(Bot, "  . Welcome to: ."..frmHub:GetHubName()..".")
   user:SendData(Bot, "  . Your Status in this Hub: "..(GetProfileName(user.iProfile) or "Not registerd"))
   user:SendData(Bot, "  . Actual Share in the Hub: "..hubshare.." GB")
   user:SendData(Bot, "  . There are: "..ops.." OPs . "..vips.." VIPs . "..users.." Unregged Users online")
   user:SendData(Bot, "  . Use: !help to display help page")
   user:SendData(Bot, ":-------------------------------------------------------------------------------------------------------------:")
   end
end
plop
Title:
Post by: nEgativE on 29 December, 2003, 22:17:31
Yes, i will test that.. but tell me, is it possible to get the total reg users ? ex: user:SendData(Bot, "       ? Total reg users on Hub: 450 ".")

I know that it's possible to get the names in the file, but the amount ? Hehe..
not the current online, but all the amount registered in the file.

Tks in advance !! sorry the english.
Title:
Post by: plop on 30 December, 2003, 02:16:34
how about i alter that a little bit.
online_ops/offline_ops
online_vips/offline_vips
online_regs/offline_regs
online_unregs

then you got all.  lol

plop
Title:
Post by: nEgativE on 30 December, 2003, 03:13:39
QuoteOriginally posted by plop
how about i alter that a little bit.
online_ops/offline_ops
online_vips/offline_vips
online_regs/offline_regs
online_unregs

then you got all.  lol

plop

??  !!! what ? Hehe..

sorry i did not understoud !!  :(
Title:
Post by: plop on 02 January, 2004, 04:45:39
you'll see when i'm done.

plop
Title:
Post by: plop on 06 January, 2004, 19:45:28
i think i'm done.
maby it turned out looking a bit complex.
but it can show all of the next:
total registered users/vips/ops/master/etc (any extra user level you might have)
total online unregistered users/users/vips/ops/master/etc (any extra user level you might have)
by subtracting online from the total you can get the offline number 2 but gues you all had that stuff allready @ school. lol
5 seconds after adding/deleting a user it reloads the users (add the script commands if you use a script for those tasks, make sure this bot gets executed before that script).
-----------------------------------------------------------------------------
-- online user counter by plop
-- 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
-----------------------------------------------------------------------------

Bot = "tables_and_no_chairs"

LEVELSTOT = {["0"]=0, ["1"]=0, ["2"]=0, ["3"]=0}
LEVELS = {["0"]=0, ["1"]=0, ["2"]=0, ["3"]=0, ["-1"]=0}


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 mastes 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)
   local info = "\r\n\r\n"
   info = info..":-------------------------------------------------------------------------------------------------------------:\r\n"
   info = info.."  . "..user.sName..".\r\n"
   info = info.."  . Your IP: "..user.sIP.."\r\n"
   info = info.."  . Welcome to: ."..frmHub:GetHubName()..".\r\n"
   info = info.."  . Your Status in this Hub: "..(GetProfileName(user.iProfile) or "Not registerd")..".\r\n"
   info = info.."  . Actual Share in the Hub: "..hubshare.." GB\r\n"
   info = info.."  . "..tmp3.." out of "..tmp.." OPs are here to do there duty. \r\n"
   info = info.."  . There are "..LEVELS["2"].." VIPs in the hub, "..tmp1.." are out hunting files or lady's. \r\n"
   info = info.."  . "..LEVELS["3"].." liked this hub so much they took the liberty to register, "..tmp2.." got abducted by aliens\r\n"
   info = info.."  . Whats left are "..LEVELS["-1"].." unregistered users making a total of "..(tmp1+tmp2+tmp3+LEVELS["-1"]).." here in the hub\r\n"
   info = info.."  . Use: !help to display help page\r\n"
   info = info..":-------------------------------------------------------------------------------------------------------------:\r\n"
   user:SendPM(Bot, info.." |")
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")
   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
plop
Title:
Post by: plop on 08 January, 2004, 02:08:02
tiny update and added a short manual.
should make life with this script be a little bit easyer.
-----------------------------------------------------------------------------
-- 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 = "tables_and_no_chairs"

-- 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)
   local info = "\r\n\r\n"
   info = info..":-------------------------------------------------------------------------------------------------------------:\r\n"
   info = info.."  . "..user.sName..".\r\n"
   info = info.."  . Your IP: "..user.sIP.."\r\n"
   info = info.."  . Welcome to: ."..frmHub:GetHubName()..".\r\n"
   info = info.."  . Your Status in this Hub: "..(GetProfileName(user.iProfile) or "Not registerd")..".\r\n"
   info = info.."  . Actual Share in the Hub: "..hubshare.." GB\r\n"
   info = info.."  . "..tmp3.." out of "..tmp.." OPs are here to do there duty. \r\n"
   info = info.."  . There are "..LEVELS["2"].." VIPs in the hub, "..tmp1.." are out hunting files or lady's. \r\n"
   info = info.."  . "..LEVELS["3"].." liked this hub so much they took the liberty to register, "..tmp2.." got abducted by aliens\r\n"
   info = info.."  . Whats left are "..LEVELS["-1"].." unregistered users.\r\n"
   info = info.."  . Making a total of "..frmHub:GetUsersCount().." users here in the hub\r\n"
   info = info.."  . Use: !help to display help page\r\n"
   info = info..":-------------------------------------------------------------------------------------------------------------:\r\n"
   user:SendPM(Bot, info.." |")
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
plop
Title:
Post by: nEgativE on 16 January, 2004, 06:43:40
QuoteOriginally posted by plop
tiny update and added a short manual.
should make life with this script be a little bit easyer.
-----------------------------------------------------------------------------
-- 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 = "tables_and_no_chairs"

-- 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)
   local info = "\r\n\r\n"
   info = info..":-------------------------------------------------------------------------------------------------------------:\r\n"
   info = info.."  . "..user.sName..".\r\n"
   info = info.."  . Your IP: "..user.sIP.."\r\n"
   info = info.."  . Welcome to: ."..frmHub:GetHubName()..".\r\n"
   info = info.."  . Your Status in this Hub: "..(GetProfileName(user.iProfile) or "Not registerd")..".\r\n"
   info = info.."  . Actual Share in the Hub: "..hubshare.." GB\r\n"
   info = info.."  . "..tmp3.." out of "..tmp.." OPs are here to do there duty. \r\n"
   info = info.."  . There are "..LEVELS["2"].." VIPs in the hub, "..tmp1.." are out hunting files or lady's. \r\n"
   info = info.."  . "..LEVELS["3"].." liked this hub so much they took the liberty to register, "..tmp2.." got abducted by aliens\r\n"
   info = info.."  . Whats left are "..LEVELS["-1"].." unregistered users.\r\n"
   info = info.."  . Making a total of "..frmHub:GetUsersCount().." users here in the hub\r\n"
   info = info.."  . Use: !help to display help page\r\n"
   info = info..":-------------------------------------------------------------------------------------------------------------:\r\n"
   user:SendPM(Bot, info.." |")
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
plop

Great work here plop !!! :)

i think this (LEVELS["-1"] -- total online unregistered users) is not working good, it keeps amounting users..

And i wonder if is possible to just count total registered users in the file, that one counts total offline, i think.

Thanks
Title:
Post by: plop on 16 January, 2004, 12:24:55
QuoteOriginally posted by Luso
Great work here plop !!! :)

i think this (LEVELS["-1"] -- total online unregistered users) is not working good, it keeps amounting users..

And i wonder if is possible to just count total registered users in the file, that one counts total offline, i think.

Thanks
thx m8
it only counts total registered users and the total of online users.
by subtracting those 2 you get the amount which is offline.
i'll check some more if counting of unregistered users goes oki.

plop