PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: [NL]trucker on 26 February, 2004, 10:32:42

Title: total info script :D
Post by: [NL]trucker on 26 February, 2004, 10:32:42
hya all you fine scripters

i wonder if there is someone who could make this for me and other hubowners.

i need a script what looks like this:




12:09:50] ?==============???? [NL] ????? ]-[?? [NL]=================
[12:09:50] ?
[12:09:50] ::HubOwner:[NL]trucker ---> [settings from pkotax]
[12:09:50] ::Hub Masters: TeQuilla-hollandse.ko --->[settings from pkotax]
[12:09:50] ::Hub Address: funnyhub.no-ip.info --->[settings from pkotax]
[12:09:50] ::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!
[12:09:50] ::Dutch Located : Dus NLers Welkom !! ----> [settings from pkotax]
[12:09:50] ::WebSite=www.magmar.tk
[12:09:50] ::Hub-eMail:magmarnetworks@tiscali.nl
[12:09:50] ::Max Users=200 ----> settings from pkotax
[12:09:50] ::Min Share=1GB --->settings from pkotax

==================================???? [NL] ????? ]-[?? [NL]================
[12:09:50] ::=[Min Share]------->[settings from pkotax]
[12:09:50] ::=[Max share]------->[settings from pkotax]
[12:09:50] ::=[Max Hubs allowed]------->[settings from pkotax]
[12:09:50] ::=[Min slots] ------->[settings from pkotax]
[12:09:50] ::=[Highest hubshare ever]
[12:09:50] ::=[Total hub share now]
[12:09:50] ::=[Max Hub Share]
[12:09:50] ::=[Total vips online]
[12:09:50] ::=[Total regusers online]
[12:09:50] ::=[Total Op,s online]
[12:09:50] ::=[Highest Usercount ever]
==============================================================================
[12:09:50] ::[ToTal logins][since hubstart]
[12:09:50] ::[Total Bans]
[12:09:50] ::[Total Kicks]
[12:09:50] ::[Total Warns]
[12:09:50] ::
[12:09:50] ::
[12:09:50] ::
[12:09:50] ::

[12:09:50] ::=[Total hub running time from start]
[12:09:50] ::Uptime = 0 days, 23 hrs. 30 min. and 3 sec. = ?
[12:09:50] ?======47 of 200 Users Connected======
==================================???? [NL] ????? ]-[?? [NL]================


and as an extra with seperate login messages pro setting for Master/Op/Vip so that i can send a diffrent message to diffrent people.

meaning ::

vip1 hello nice to see you  xxxxxxxxx
vip2 hay there i ,m always glad to see you back
vip 3 hey there is my favorite lady :p

and the same for OP/Master and Owner. so each person has his own login [perhaps even can create his own login?] [heard this was going to be added in robocop7]

is this all possiblle ? and will someone be so nice to look into this i would be very very greatfull.
Title:
Post by: [NL]Pur on 26 February, 2004, 14:27:06
it's a start :)

-- NL PUR for trucker ^.^ 26feb04
-- Tx to :)
-- function GetFromIni(var) by Gadget


function Main()
bot = "test"

--- Script vars
hubemail = ""
website = ""
hubnetwork = ""


end

function DataArrival(user, data)

data=strsub(data,1,strlen(data)-1)
_,_,cmd = strfind(data,"%b<>%s+(%S+)")

if (cmd=="!test") then


user:SendPM(bot,"HubOwner:"..getfromini("Admin")) -- HubOwner (PtokaX.ini)
-- hubmasters -- HubMasters (API)
user:SendPM(bot,"HubAdress:"..getfromini("HubAddress")) -- HubAdress (PtokaX.ini)
user:SendPM(bot,"HubNetwork:"..hubnetwork); -- HubNetwork (Script)
user:SendPM(bot, ""..frmHub:GetHubDescr()); -- HubDescription (API)
user:SendPM(bot,"Website:"..website); -- Website (Script)
user:SendPM(bot,"Hub-eMail:"..hubemail); -- HubEmail (Script)
user:SendPM(bot,"Max Users:"..getfromini("MaxClients")) -- MaxUsers (PtokaX.ini)
user:SendPM(bot,"Min Share:"..frmHub:GetMinShare()) -- MinShare (API)
end
end

function getfromini(var)
local result=""
readfrom("../PtokaX.ini")
while 1 do
local line=read()
if line==nil then
break
else
if strsub(line,1,strlen(var)+1)==var.."=" then
result=strsub(line,strlen(var)+2,strlen(line))
break
end
end
end
readfrom()
return result
end
Title:
Post by: [NL]trucker on 26 February, 2004, 15:10:50
[Nl]Pur

loOol

No syntax errors in script file test.lua

but doesnt show in userlist en nothing happens when i type !test .

and if i,m right this scripts sends a pm to user but it should be shown in main either on login or on timer sorry not to have mentioned it.

running with robo6.0d and pkotax 15.25.
Title:
Post by: [NL]Pur on 26 February, 2004, 15:17:36
add this

frmHub:RegBot(bot)
Title:
Post by: TiMeTrAVelleR on 26 February, 2004, 15:32:46
Maby this is somthing  you like

------------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.1 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "?RoboCop?" --// Set here your bot name
rules = "!rules"      --// Set here command for rules
netw = "!network"     --// Set here command for network list

------------------------------------------------------------------------------------------------------------------------------
--// This function is fired when an operator/master enters the hub //---------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

--frmHub:RegBot(BotName)

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(BotName,"")
   user:SendData("?=======================================================================?")
   user:SendData("   ?Welcome "..user.sName.." to "..frmHub:GetHubName().."")
   user:SendData("   ?Your IP:            "..user.sIP)
   user:SendData("   ?Your Status in this Hub:      "..(GetProfileName(user.iProfile) or "Not registerd"))
   user:SendData("   ?Actual Share in the Hub:      "..hubshare.." GB")
   user:SendData("   ?There are: "..ops.." OPs . "..vips.." VIPs . "..users.." Unregged Users online")
   user:SendData("   ?Here is now         "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users connected")
   user:SendData("   ?Hubs description is set to:      "..frmHub:GetHubDescr().."")
   user:SendData("   ?Redirect address is set to:      "..frmHub:GetRedirectAddress().."")
   user:SendData("   ?Hub register address is set to:   "..frmHub:GetRegServer().."")
   user:SendData("   ?Hubs minshare is set to:      "..frmHub:GetMinShare()/(1024).." GB")
   user:SendData("?=======================================================================?")
   user:SendData(BotName,"")
   end
end
-------------------------------------------------------------------------------------------------------------------------------
--// This function is fired when an user enters the hub //---------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
function NewUserConnected(curUser)
   local hubshare = format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
   curUser:SendData(BotName,"")
   curUser:SendData("?=======================================================================?")
   curUser:SendData("   ?Welcome "..curUser.sName.." to "..frmHub:GetHubName().."")
   curUser:SendData("   ?Your IP is:      "..curUser.sIP.."")
   curUser:SendData("   ?Here is now      "..ops.." Operator's connected to help you")
   curUser:SendData("   ?Here is now      "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users connected")
   curUser:SendData("   ?Hubs current share is    "..hubshare.." GB")
   curUser:SendData("   ?Remember to read hub rules by typing "..rules.." in main chat")
   curUser:SendData("   ?And other network hubs you can find by typing "..netw.." in main chat")
   curUser:SendData("?=======================================================================?")
   curUser:SendData(BotName,"")
end
-------------------------------------------------------------------------------------------------------------------------------
Title:
Post by: [NL]trucker on 26 February, 2004, 16:11:20
TimeTraveller

thnx i like it sofar but it isnt complete yet.

Syntax error: expected;
  last token read: `&' at line 93 in file `D:\==PTOTAX==\robo\scripts\entrybot.lua'

lol found the error and fixed it
and got an other one

Syntax error: attempt to call global `Message' (a nil value)
stack traceback:
   1:  function `OpConnected' at line 34 [file `D:\==PTOTAX==\robo\scripts\entrybot.lua']
Title:
Post by: [NL]trucker on 26 February, 2004, 16:19:43
timetraveller

how is this possible?

[16:12:37]  ?There are: 1 OPs . 0 VIPs . 252 Unregged Users online
[16:12:37]  ?Here is now 92 of 200 users connected


252 unregged users online?
while
there are only 92 of 200 users are connected?

this is total what i see in main
begin
------------------------------------------------------------------------

[16:12:37]
[16:12:37] & quote;?=======================================================================?
[16:12:37]  ?Welcome pappa to ???? [NL] ????? ]-[?? [NL]
[16:12:37]  ?Your IP: 217.121.195.6
[16:12:37]  ?Your Status in this Hub: Master
[16:12:37]  ?Actual Share in the Hub: 2756.81 GB
[16:12:37]  ?There are: 1 OPs . 0 VIPs . 252 Unregged Users online
[16:12:37]  ?Here is now 92 of 200 users connected
[16:12:37]  ?Hubs description is set to: ?????? Magmar ?????? Network Dutch Division  A Funny Hub To Be !! Dutch Located :) Dus NLers Welkom !!
[16:12:37]  ?Redirect address is set to: dennis666.no-ip.com:9009
[16:12:37]  ?Hub register address is set to: dreamland.gotdns.org;vandel405.dynip.com;dcreg.mine.nu;warez.1stleg.com:
[16:12:37]  ?Hubs minshare is set to: 5 GB
[16:12:37] & quote;?=======================================================================?
[16:12:37]

---------------------------------------------------------------------end
Title:
Post by: [NL]trucker on 26 February, 2004, 16:44:21
lol
i tried to adjust the script a bit and now i get this :

Syntax error: cannot access a variable in outer scope;
  last token read: `days' at line 116 in file `D:\==PTOTAX==\robo\scripts\entrybot.lua'

here is the scrpt.

what did i do wrong?

========================================

------------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.1 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "?RoboCop?" --// Set here your bot name
rules = "!rules" --// Set here command for rules
netw = "!network" --// Set here command for network list

------------------------------------------------------------------------------------------------------------------------------
--// This function is fired when an operator/master enters the hub //---------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

--frmHub:RegBot(BotName)


local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
      

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(BotName,"")
user:SendData("?=======================================================================?")
user:SendData(" ?Welcome "..user.sName.." to "..frmHub:GetHubName().."")
user:SendData(" ?Your IP: "..user.sIP)
user:SendData(" ?Your Status in this Hub: "..(GetProfileName(user.iProfile) or "Not registerd"))
user:SendData(" ?Actual Share in the Hub: "..hubshare.." GB")
user:SendData(" ?There are: "..ops.." OPs . "..vips.." VIPs . "..users.." Unregged Users online")
user:SendData(" ?Here is now "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users connected")
user:SendData(" ?Hubs description is set to: "..frmHub:GetHubDescr().."")
user:SendData(" ?Redirect address is set to: "..frmHub:GetRedirectAddress().."")
user:SendData(" ?Hub register address is set to: "..frmHub:GetRegServer().."")
user:SendData(" ?Hubs minshare is set to: "..frmHub:GetMinShare()/(1024).." GB")
user:SendData("?=======================================================================?")
user:SendData(BotName,"::Uptime = "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")    
        (BotName,"?======"..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected======")
   return 1
   end
user:SendData(BotName,"")
end
end
-------------------------------------------------------------------------------------------------------------------------------
--// This function is fired when an user enters the hub //---------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
function NewUserConnected(curUser)
local hubshare = format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
curUser:SendData(BotName,"")
curUser:SendData("?=======================================================================?")
curUser:SendData(" ?Welcome "..curUser.sName.." to "..frmHub:GetHubName().."")
curUser:SendData(" ?Your IP is: "..curUser.sIP.."")
curUser:SendData(" ?Here is now "..ops.." Operator's connected to help you")
curUser:SendData(" ?Here is now "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users connected")
curUser:SendData(" ?Hubs current share is "..hubshare.." GB")
curUser:SendData(" ?Remember to read hub rules by typing "..rules.." in main chat")
curUser:SendData(" ?And other network hubs you can find by typing "..netw.." in main chat")
curUser:SendData("?=======================================================================?")
curuser:SendData(BotName,"::Uptime = "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")    
      BotName,"?======"..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected======")
   return 1
   end
curUser:SendData(BotName,"")
end


-----------------------------------------------------------------------
Title:
Post by: lynyrd on 26 February, 2004, 16:52:13
exscuse a noob but shouldnt it be "days." instead of "days," ?

user:SendData(BotName,"::Uptime = "..days.." days.  "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")

as said im a noob don't hit me if im wrong ;)
Title:
Post by: [NL]trucker on 26 February, 2004, 17:15:06
lynyrd


nope this works fine with another script.
Title:
Post by: TiMeTrAVelleR on 26 February, 2004, 17:19:28
will ask   cyber  he is the one  who made it   you know him also  he is master in my hub

TiMe
Title:
Post by: nEgativE on 03 March, 2004, 03:27:59
Hi there, what could B wrong with that uptime ?

(Syntax error: cannot access a variable in outer scope;
last token read: `days' at line 116 in file)
Title:
Post by: nErBoS on 03 March, 2004, 03:36:04
Hi,

in this..

local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)

remove the local...

sec = clock()
days = floor(sec/86400)
hrs = floor((sec-(days*86400))/3600)
min = floor((sec-(days*86400)-(hrs*3600))/60)

I think that should do the trick.

Best regards, nErBoS
Title:
Post by: [NL]trucker on 03 March, 2004, 12:11:05
thnx Nerbos

 but it seems that i cannot run a hubinfo script; if i have cleared one error i get another one (:-

for now i,m leaving this till i have enough courage to get on with it again.
Title:
Post by: acethecase on 03 March, 2004, 13:07:47
hey m8ts--
Its a great intro/info script, and u all are great scripters..
Im sure u can make it work properly werry soon,
I would like to use this one  :D Keep up the good work!!
Title:
Post by: nErBoS on 03 March, 2004, 14:39:56
Hi,

What are the other errors ?? Maybe i can help.

Best regards, nErBoS
Title:
Post by: Optimus on 03 March, 2004, 16:02:10
I have -Updated- this 1 a little bit for Cyber... You can all start working from there!

Here Ya go ... :D



-----------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.3 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "????????M?C???????" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = kb*kb*kb

function NewUserConnected(user)
Message(user)
end

function OpConnected(user)
Message(user)
end

function UserDisconnected(user)
end

function OpDisconnected(user)
end

--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end


function Message(user)
local disp = ""
doGetProfile =  GetProfileName(user.iProfile) or "Not registerd"
local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
if share == nil then
return 1
end
minshare = format("%0.2f", tonumber(share)/gb)
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
border1 = "<>=========================H=U=B==I=N=F=O==============================="
border2 = "<>======================================================================"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.." GB\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] - "..ProfileCounter("Operator").." [OPERATOR] - "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub register address is: "..frmHub:GetRegServer().."\r\n"
disp = disp.." ?Hub minshare is: "..frmHub:GetMinShare()/(1024).." GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"..border2.."\r\n"

user:SendData(BotName, disp)
end



Title:
Post by: [NL]trucker on 03 March, 2004, 16:14:21
Optimus

i have troublles getting the minshare to work as i use robocop 6.0d

is there a way that the script take settings from your bot?

this is what i get in main now
- - - - - - - - - - - - - - - - - -

[16:08:53]

- <>=========================H=U=B==I=N=F=O===============================
   ?Welcome:      pappa
   ?To this fine place Called:   ???? [NL] ????? ]-[?? [NL]
   ?Your IP:         xxx.xxx.xxx.xxx
   ?Your Share:      56.50 GB
   ?Your Status in this Hub:   Master
   ?Actual Share in the Hub:   2016.35 GB
   ?There are:       3 [MASTER] - 3 [OPERATOR] - 11 [VIP] online
   ?There are now:      61 of 200 users connected
   ?Hub description is:      ?????? Magmar ?????? Network Dutch Division  A Funny Hub To Be !! Dutch Located :) Dus NLers Welkom !!
   ?Hub register address is:   dreamland.gotdns.org;vandel405.dynip.com;dcreg.mine.nu;warez.1stleg.com:
   ?Hub minshare is:      0 GB
   ?Redirect address is:   wizzcat.no-ip.com
- <>======================================================================
Title:
Post by: *??G??* on 03 March, 2004, 19:45:43
hmmm....tried it and I too get the Hub minshare is 0 GB....could it be because my minshare is set to 500 MB
Title:
Post by: Optimus on 03 March, 2004, 21:26:30



-----------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.3 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "????????M?C???????" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = kb*kb*kb

function NewUserConnected(user)
Message(user)
end

function OpConnected(user)
Message(user)
end

function UserDisconnected(user)
end

function OpDisconnected(user)
end

--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end


function Message(user)
local disp = ""
doGetProfile =  GetProfileName(user.iProfile) or "Not registerd"
local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
if share == nil then
return 1
end
minshare = format("%0.2f", tonumber(share)/gb)
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
border1 = "<>=========================H=U=B==I=N=F=O==============================="
border2 = "<>======================================================================"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.." GB\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] - "..ProfileCounter("Operator").." [OPERATOR] - "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub register address is: "..frmHub:GetRegServer().."\r\n"
disp = disp.." ?Hub minshare is: "..frmHub:GetMinShare()/(1024).." GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"..border2.."\r\n"

user:SendData(BotName, disp)
end


Title:
Post by: *??G??* on 03 March, 2004, 22:03:35
ah.....i figured out my prob.....i had the minshare set in robocop but not ptokax....i set it in ptokax and it works great now.....thnx Optimus
Title:
Post by: [NL]trucker on 03 March, 2004, 23:30:22
Optimus

this is your infobot in main
---------------------------------------------------------------
[23:25:59]

- <>=========================H=U=B==I=N=F=O===============================
   ?Welcome:      pappa
   ?To this fine place Called:   ???? [NL] ????? ]-[?? [NL]
   ?Your IP:         217.121.195.6
   ?Your Share:      56.50 GB
   ?Your Status in this Hub:   Master
   ?Actual Share in the Hub:   1326.55 GB
   ?There are:       4 [MASTER] - 3 [OPERATOR] - 9 [VIP] online
   ?There are now:      50 of 200 users Online
   ?Hub description is:      ?????? Magmar ?????? Network Dutch Division  A Funny Hub To Be !! Dutch Located :) Dus NLers Welkom !!
   ?Hub register address is:   dreamland.gotdns.org;vandel405.dynip.com;dcreg.mine.nu;warez.1stleg.com:
   ?Hub minshare is:      0 GB
   ?Redirect address is:   wizzcat.no-ip.com
- <>======================================================================


still no go at the min share.

but could you make it like this?

----------------------------------------------------------------------

[23:05:16]

Welcome pappa To ???? [NL] ????? ]-[?? [NL]
?-=-=-=-=-=-=-=-=-? I N F O R M A T I O N ?-=-=-=-=-=-=-=-=-?

Information about you :
Your IP ? xxx.xxx.xxx.
Your Client ? DC++
Version ? 0.261
Mode ? Active
Your share ? 56.50

You are in 0 Hubs as a normal user
You are in 13 ubs as a regged user =12 hubs
You are in 17 Hubs as an OP user = 13 hubs

Hub Settings :
Minimum share ? 0 <- still no go
Minimum slots ? 2
Maximum slots ? 20
Maximum hubs ? 20
Maximum users ? 200

Hub Statistic :
Uptime ? 0 Days 4 Hours and 44 Minutes
Amount of users now ? 51
Total share amount ? 1.50 TB
Online OP's ? 1 = 4
Online VIP's ? 0 = tomuch ..lol
Online Reg's ? 0 = tomuch

?-=-=-=-=-=-=-=-=-? I N F O R M A T I O N ?-=-=-=-=-=-=-=-=-?
[23:05:16] Welcome back pappa

this is made by kepp in this thread
http://board.univ-angers.fr/thread.php?threadid=1435&boardid=13&styleid=1&sid=579bd8b13817711a69f077accfb1883c&page=4#70

perhaps a co operative joint venture??

we still have a few errors to solve in that one as you can see.
Title:
Post by: kepp on 03 March, 2004, 23:45:09
The minshare is related to PtokaX, not the script itself...
if you have 0 gb in PtokaX settings and if it's disabled, then the result of that will be 0...
so, if you are letting another script taking care of the minshare then don't forget to change the number to your hub minimum share in ptokax and keep it disabled.
Title:
Post by: [NL]trucker on 03 March, 2004, 23:54:58
OPtimus

stack traceback:
   1:  function `strfind' [C]
   2:  function `Message' at line 40 [file `D:\==PTOTAX==\trucker\scripts\optimus.lua']
   3:  function `NewUserConnected' at line 12 [file `D:\==PTOTAX==\trucker\scripts\optimus.lua']

and it resulted in a flood of donkeys whn i removed the script and forgot to do a restartscripts in pkotax
Title:
Post by: kepp on 04 March, 2004, 00:17:25
-----------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.3 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "????????M?C???????" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = kb*kb*kb

function NewUserConnected(user)
Message(user)
end

function OpConnected(user)
Message(user)
end

function UserDisconnected(user)
end

function OpDisconnected(user)
end

--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end


function Message(user)
local disp = ""
doGetProfile =  GetProfileName(user.iProfile) or "Not registerd"
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
if share == nil then
return 1
end
minshare = format("%0.2f", tonumber(share)/gb)
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
border1 = "<>=========================H=U=B==I=N=F=O==============================="
border2 = "<>======================================================================"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.." GB\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] - "..ProfileCounter("Operator").." [OPERATOR] - "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub register address is: "..frmHub:GetRegServer().."\r\n"
disp = disp.." ?Hub minshare is: "..frmHub:GetMinShare()/(1024).." GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"..border2.."\r\n"

user:SendData(BotName, disp)
end
Title:
Post by: Optimus on 04 March, 2004, 01:06:17
Me just pasted the code so others can continiou, cause this way was much quicker and less code then the first 1.

Specialy the Table for counting the profiles, this 1 is much better/quicker!

Take it & Combine it it's a good start to make more :]
Title:
Post by: acethecase on 04 March, 2004, 13:16:33
- <>=========================H=U=B==I=N=F=O===============================
   ?Welcome:      [SU]aCe
   ?To this fine place Called:   [BBB]Stockholm][10Mbit]
   ?Your IP:         ****
   ?Your Share:      0.59 GB
   ?Your Status in this Hub:   Master
   ?Actual Share in the Hub:   2946.09 GB
   ?There are:       1 [MASTER] - 8 [OPERATOR] - 0 [VIP] online
   ?There are now:      97 of 500 users Online
   ?Hub minshare is:      3 GB
   ?Redirect address is:   
- <>======================================================================

I have remowed Hub description and Hub is reg @ -
no need for that I think.. Insted is it posible to add
(CT) Local Time - **:** and date *.*.**
Title:
Post by: nErBoS on 04 March, 2004, 15:06:21
Hi,

Done..

-----------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.3 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "????????M?C???????" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = kb*kb*kb

function NewUserConnected(user)
Message(user)
end

function OpConnected(user)
Message(user)
end

function UserDisconnected(user)
end

function OpDisconnected(user)
end

--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end


function Message(user)
local disp = ""
doGetProfile =  GetProfileName(user.iProfile) or "Not registerd"
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
if share == nil then
return 1
end
minshare = format("%0.2f", tonumber(share)/gb)
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
border1 = "<>=========================H=U=B==I=N=F=O==============================="
border2 = "<>======================================================================"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.." GB\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] - "..ProfileCounter("Operator").." [OPERATOR] - "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub register address is: "..frmHub:GetRegServer().."\r\n"
disp = disp.." ?Hub minshare is: "..frmHub:GetMinShare()/(1024).." GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"..border2.."\r\n"
disp = disp.." ?Time: "..GetTime()

user:SendData(BotName, disp)
end

function GetTime()
s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")
Date = "Date: "..d.."/"..mm.."/20"..y.." Hour: "..h..":"..m..":"..s
return Date
end

Best regards, nErBoS
Title:
Post by: acethecase on 04 March, 2004, 16:16:37
Nice thanx m8 for fast replay ---
 :D  :D  :D  :D  :D  :D  :D  :D

Just one little thing :

- <>=========================H=U=B==I=N=F=O===============================
   ?Welcome:      [SU]aCe
   ?To this fine place Called:   [BBB]Stockholm][10Mbit]
   ?Your IP:         ****
   ?Your Share:      0.59 GB
   ?Your Status in this Hub:   Master
   ?Actual Share in the Hub:   3217.78 GB
   ?There are:       1 [MASTER] - 7 [OPERATOR] - 0 [VIP] online
   ?There are now:      105 of 500 users Online
   ?Hub minshare is:      3 GB
   ?Redirect address is:   
- <>======================================================================
   ?Time:         Date: 04/03/2004 Hour: 16:25:25

Put the time/date in same ram/line  us the others one: l
Title:
Post by: TiMeTrAVelleR on 04 March, 2004, 16:50:40
Last 2 lines  make it like this   kopie paste

disp = disp.."   ?Redirect address is:   "..frmHub:GetRedirectAddress().."\r\n"..
   disp = disp.."   ?Time:         "..GetTime().."\r\n"..border2.."\r\n"
Title:
Post by: acethecase on 04 March, 2004, 17:03:11
thanx m8, got it.--all working nice.. :D
Title:
Post by: [NL]trucker on 04 March, 2004, 22:56:24
hello

if i take this part of your script

---------------------------------------------------------------

--// Profile Counter
function ProfileCounter(profile)
   local table, count = GetUsersByProfile(profile), 0
   for i, User in table do
      if GetItemByName(User) then
         count = count + 1
      end
   end
   return count
end

        disp = disp.."   ==================================================================="
        disp = disp.."   ?There are:    "..ProfileCounter("Master").." [MASTER] -\r\n"
        disp = disp.."   ?There are:     "..ProfileCounter("Operator").." [OPERATOR] -\r\n"
        disp = disp.."   ?There are:     "..ProfileCounter("Vip").." [VIP]- \r\n"
        disp = disp.."   ?There are:     "..profilecounter("Reg").." [Registerd users]- online \r\n"
   disp = disp.."   \r\n\r\n"
        disp = disp.."   ?There are now:   "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
        disp = disp.."   ==================================================================="
        user:SendData(BotName, disp)
end

---------------------------------------------------------------------

why isn,t this working?
i get from script-editor

Syntax error: expected;
  last token read: `end' at line 21 in file `D:\==PTOTAX==\trucker\scripts\usercount.lua'

and as far as i see there is a end of file
Title:
Post by: nErBoS on 04 March, 2004, 23:18:35
Hi,

This part have no function....

disp = disp.." ==================================================================="
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] -\r\n"
disp = disp.." ?There are: "..ProfileCounter("Operator").." [OPERATOR] -\r\n"
disp = disp.." ?There are: "..ProfileCounter("Vip").." [VIP]- \r\n"
disp = disp.." ?There are: "..profilecounter("Reg").." [Registerd users]- online \r\n"
disp = disp.." \r\n\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ==================================================================="
user:SendData(BotName, disp)
end

try to put on the top "function Message(user)" like in the original script.

Best regards, nErBoS
Title:
Post by: [NL]trucker on 05 March, 2004, 01:28:56
Nerbos

got no more errors but script isn,t showing in main when i reconnect.

howcome?
Title:
Post by: nErBoS on 05 March, 2004, 02:11:03
Hi,

Your script or this script ???

If is it yours try to see if you are calling the function where you show the info in the function NewUserConnected and function OpConnected.

Best regards, nErBoS
Title:
Post by: acethecase on 05 March, 2004, 03:11:35
Hi nErBoS&all others
I wonder if you can put some more info in like:

Peak Users: ***
Peak Share: ***

tnx 8)
Title:
Post by: nErBoS on 05 March, 2004, 20:00:42
Hi,

Do not know if is possible to get the peak of share and users from the hub software, i could make is a little stat code, do you want that ??

Best regards, nErBoS
Title:
Post by: acethecase on 05 March, 2004, 21:42:30
Hi m8 .
Sure sounds good ?I can always tryit."
tnx

btw I have another little script that is showing peek users and peek share,
may be u can conbine it in to urs script..
This is what it shows in main :

   Logins: 6451
   Peak Users: 163   -   Current Users: 143   -   Max Users Allowed: 500
   Peak Share: 5.64 TB   -   Current Share: 4.51 TB   -   Share/User: 32.29 GB/User

   Total Regged User: 61 in 4 Profiles

       - Master: 1
       - Operator: 22
       - VIP: 38
       - Reg: 0

and this is the script :!

--Hub Stats V.01 by chill
--Serialisation by RabidWombat

statFile = "HubStats.txt"   -- The Filename
statFolder = "txt"      -- The Foldername set it to nil if not wanted
Max1 = 10         -- Time between each stats saving
cmd1 = "+hubstats"      -- Shows the Hub Stats

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
--   MAIN SCRIPT
--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

if statFolder then
   statFile = statFolder.."/"..statFile
end

HubStats = {
   Logins = 0,
   MaxShareAmount = frmHub:GetCurrentShareAmount(),
   MaxUsers = frmHub:GetUsersCount(),
   StatsSince = date("%d/%m/%y"),
}
dofile(statFile)
--------------------------------------------------------
function Main()
   SetTimer(60*1000*Max1)
   StartTimer()
end
function OnExit()
   WriteTable(HubStats,"HubStats",statFile)
end
--------------------------------------------------------
function OnTimer()
   WriteTable(HubStats,"HubStats",statFile)
end
--------------------------------------------------------
function NewUserConnected(curUser)
   if (frmHub:GetCurrentShareAmount() > HubStats.MaxShareAmount) then
      HubStats.MaxShareAmount = frmHub:GetCurrentShareAmount()
   end
   if (frmHub:GetUsersCount() > HubStats.MaxUsers) then
      HubStats.MaxUsers = frmHub:GetUsersCount()
   end
   HubStats.Logins = HubStats.Logins + 1
end
OpConnected = NewUserConnected
--------------------------------------------------------
function DataArrival(curUser,data)
   if strsub(data,1,1) == "<" then
      data = strsub(data,strlen(curUser.sName)+4,strlen(data)-1)
      local _,_,word1 = strfind(data,"^(%S+)")
      if word1 and hubStatFunc[word1] then
         curUser:SendData(hubStatFunc[word1]())
         return 1
      end
   end
end
---------------------------------------------------------------------------------------

--   Hub Stats Functions
---------------------------------------------------------------------------------------
hubStatFunc = {
   [cmd1] = function()
      local msg = "---  Hub Stats Since "..HubStats.StatsSince.."  ---\r\n\r\n"
      msg = msg.."\tLogins: "..HubStats.Logins.."\r\n"..
      "\tPeak Users: "..HubStats.MaxUsers.."   -   Current Users: "..frmHub:GetUsersCount().."   -   Max Users Allowed: "..frmHub:GetMaxUsers().."\r\n"..
      "\tPeak Share: "..format("%.2f",(HubStats.MaxShareAmount/(1024*1024*1024*1024))).." TB"..
      "   -   Current Share: "..format("%.2f",(frmHub:GetCurrentShareAmount()/(1024*1024*1024*1024))).." TB"..
      "   -   Share/User: "..format("%.2f",(frmHub:GetCurrentShareAmount()/(1024*1024*1024)/frmHub:GetUsersCount())).." GB/User\r\n\r\n"..
      GetReggedUsers()
      return(msg)
   end,
}

function GetReggedUsers()
   local tcount,pcount = 0,0,0
   local msg = ""
   for _,profile in GetProfiles() do
      pcount = pcount + 1
      local ucount = 0
      for _,_ in GetUsersByProfile(profile) do
         ucount = ucount + 1
         tcount = tcount + 1
      end
      msg = msg.."\t    - "..profile..": "..ucount.."\r\n"
   end
   msg = "\tTotal Regged User: "..tcount.." in "..pcount.." Profiles\r\n\r\n"..msg
   return(msg)
end
---------------------------------------------------------------------------------------

--   Write Tables

---------------------------------------------------------------------------------------
function WriteTable(table,tablename,file)
   local handle = openfile(file,"w")
   Serialize(table,tablename,handle)
     closefile(handle)
end
--------------------------------------------
function Serialize(tTable,sTableName,hFile,sTab)
   sTab = sTab or "";
   write(hFile,sTab..sTableName.." = {\n");
   for key,value in tTable do
      local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
      if(type(value) == "table") then
         Serialize(value,sKey,hFile,sTab.."\t");
      else
         local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
         write(hFile,sTab.."\t"..sKey.." = "..sValue);
      end
      write(hFile,",\n");
   end
   write(hFile,sTab.."}");
end
Title:
Post by: nErBoS on 06 March, 2004, 00:12:06
Hi,

That was what i was thinking on doing.

Here is it hope it helps...

-----------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.3 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "????????M?C???????" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = kb*kb*kb

Stattxt = "Stat.txt" --Will be created in the script folder

Stat = {
logins = 0,
share = 0,
users = 0,
}
function Main()
frmHub:RegBot(BotName)
end

OpConnected = NewUserConnected

function NewUserConnected(user)
local s,e,usrshare = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
if (readfrom(Stattxt) == nil) then
if (Stat.users < frmHub:GetUsersCount() ) then
Stat.users = frmHub:GetUsersCount()
else
end
if (Stat.share < frmHub:GetCurrentShareAmount() + usrshare) then
Stat.share = frmHub:GetCurrentShareAmount() + usrshare
end
Stat.logins = Stat.logins + 1
SaveToFile(Stattxt , Stat , "Stat")
else
LoadFromFile (Stattxt)
local logins = Stat["logins"]
local share = Stat["share"]
local users = Stat["users"]
if (users < frmHub:GetUsersCount() ) then
Stat.users = frmHub:GetUsersCount()
else
Stat.users = users
end
if (share < frmHub:GetCurrentShareAmount() + usrshare) then
Stat.share = frmHub:GetCurrentShareAmount() + usrshare
else
Stat.share = share
end
Stat.logins = logins + 1
SaveToFile(Stattxt , Stat , "Stat")
end


Message(user)
end

OpDisconnected = UserDisconnected


function UserDisconnected(user)
end

--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end


function Message(user)
local disp = ""
doGetProfile =  GetProfileName(user.iProfile) or "Not registerd"
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
local ttshare = format("%0.2f", tonumber(Stat.share)/gb)
if share == nil then
return 1
end
minshare = format("%0.2f", tonumber(share)/gb)
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
border1 = "<>=========================H=U=B==I=N=F=O==============================="
border2 = "<>======================================================================"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.." GB\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] - "..ProfileCounter("Operator").." [OPERATOR] - "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub register address is: "..frmHub:GetRegServer().."\r\n"
disp = disp.." ?Hub minshare is: "..frmHub:GetMinShare()/(1024).." GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"
disp = disp.." ?Peak of share: "..ttshare.." GB\r\n"
disp = disp.." ?Peak of users: "..Stat.users.."\r\n"
disp = disp.." ?Logins: "..Stat.logins.."\r\n"
disp = disp.." ?Time: "..GetTime().."\r\n"..border2.."\r\n"

user:SendData(BotName, disp)
end

function GetTime()
s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")
Date = "Date: "..d.."/"..mm.."/20"..y.." Hour: "..h..":"..m..":"..s
return Date
end

function Serialize(tTable, sTableName, hFile, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(hFile, "hFile equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";

write(hFile, sTab..sTableName.." = {\n" );

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
write(hFile, sTab.."\t"..sKey.." = "..sValue);
end

write(hFile, ",\n");
end

write(hFile, sTab.."}");
end

function SaveToFile(file , table , tablename)
local hFile = openfile(file, "w");
Serialize(table, tablename, hFile);
closefile(hFile);
end

function LoadFromFile (file)
assert(readfrom(file),"Making file, not to horry")
dostring(read("*all"))
readfrom()
end

Best regards, nErBoS
Title:
Post by: acethecase on 06 March, 2004, 00:50:38
firs thanx for script
second its not working ..lol
Nonthing is happening, no info in main!!
Strange beacuse no error report:

No syntax errors in script file C:\Documents and Settings\ace\Mina dokument\-=HUB=-\THE HUB\scripts\EntryBot 0.3.lua
Title:
Post by: nErBoS on 06 March, 2004, 01:04:21
Hi,

Sorry my bad :P

-----------------------------------------------------------------------------------------------------------------------------
---// EntryBot 0.3 By Cyberbob //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------

BotName = "????????M?C???????" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = kb*kb*kb

Stattxt = "Stat.txt" --Will be created in the script folder

Stat = {
logins = 0,
share = 0,
users = 0,
}
function Main()
frmHub:RegBot(BotName)
end

function NewUserConnected(user, data)
local s,e,usrshare = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
if (readfrom(Stattxt) == nil) then
if (Stat.users < frmHub:GetUsersCount() ) then
Stat.users = frmHub:GetUsersCount()
else
end
if (Stat.share < frmHub:GetCurrentShareAmount() + usrshare) then
Stat.share = frmHub:GetCurrentShareAmount() + usrshare
end
Stat.logins = Stat.logins + 1
SaveToFile(Stattxt , Stat , "Stat")
else
LoadFromFile (Stattxt)
local logins = Stat["logins"]
local share = Stat["share"]
local users = Stat["users"]
if (users < frmHub:GetUsersCount() ) then
Stat.users = frmHub:GetUsersCount()
else
Stat.users = users
end
if (share < frmHub:GetCurrentShareAmount() + usrshare) then
Stat.share = frmHub:GetCurrentShareAmount() + usrshare
else
Stat.share = share
end
Stat.logins = logins + 1
SaveToFile(Stattxt , Stat , "Stat")
end


Message(user)
end

OpConnected = NewUserConnected

function UserDisconnected(user, data)
end

OpDisconnected = UserDisconnected

--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end


function Message(user)
local disp = ""
doGetProfile =  GetProfileName(user.iProfile) or "Not registerd"
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
local ttshare = format("%0.2f", tonumber(Stat.share)/gb)
if share == nil then
return 1
end
minshare = format("%0.2f", tonumber(share)/gb)
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
border1 = "<>=========================H=U=B==I=N=F=O==============================="
border2 = "<>======================================================================"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.." GB\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] - "..ProfileCounter("Operator").." [OPERATOR] - "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub register address is: "..frmHub:GetRegServer().."\r\n"
disp = disp.." ?Hub minshare is: "..frmHub:GetMinShare()/(1024).." GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"
disp = disp.." ?Peak of share: "..ttshare.." GB\r\n"
disp = disp.." ?Peak of users: "..Stat.users.."\r\n"
disp = disp.." ?Logins: "..Stat.logins.."\r\n"
disp = disp.." ?Time: "..GetTime().."\r\n"..border2.."\r\n"

user:SendData(BotName, disp)
end

function GetTime()
s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")
Date = "Date: "..d.."/"..mm.."/20"..y.." Hour: "..h..":"..m..":"..s
return Date
end

function Serialize(tTable, sTableName, hFile, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(hFile, "hFile equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";

write(hFile, sTab..sTableName.." = {\n" );

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
write(hFile, sTab.."\t"..sKey.." = "..sValue);
end

write(hFile, ",\n");
end

write(hFile, sTab.."}");
end

function SaveToFile(file , table , tablename)
local hFile = openfile(file, "w");
Serialize(table, tablename, hFile);
closefile(hFile);
end

function LoadFromFile (file)
assert(readfrom(file),"Making file, not to horry")
dostring(read("*all"))
readfrom()
end

Best regards, nErBoS
Title:
Post by: acethecase on 06 March, 2004, 01:34:14
nicceee m8.. Thanx allot for all ya help,you the man--- :D

- <>=========================H=U=B==I=N=F=O===============================
   ?Welcome:      [SU]aCe
   ?To this fine place Called:   [BBB]Stockholm][10Mbit]
   ?Your IP:   ****      
   ?Your Share:      6.95 GB
   ?Your Status in this Hub:   Master
   ?Actual Share in the Hub:   3669.55 GB
   ?There are:       1 [MASTER] - 8 [OPERATOR] - 1 [VIP] online
   ?There are now:      110 of 500 users Online
   ?Hub minshare is:      3 GB
   ?Peak of share:      3846.21 GB
   ?Peak of users:      114
   ?Logins:         134
   ?Redirect address is:   
   ?Time:         Date: 06/03/2004 Hour: 01:29:17
- <>======================================================================
Title:
Post by: nEgativE on 06 March, 2004, 05:13:52
Hi all, Hi nErBoS, Bom trabalho :))
i wonder if its possible to include those (peak users and peak share) funtions on this one ? :-)


-----------------------------------------------------------------------------
-- 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+)%$")
   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(Bot, " <-----=[- "..frmHub:GetHubName().." ? v2004 -]=----->")
   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 - Limite minimo: "..frmHub:GetMinShare()/(1024).." 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: [URL]www.lusobrasil.site.vu[/URL]")
   user:SendData(Bot, "      ? "..GetTime().."")
   user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
   user:SendData(Bot, "      ? Registros sem login no Hub por: 1 semana(s) ser?o auto-removidos. [- Perman?ncia de 5 min. -]")
   user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
end
-------------------------------------------------------------------------------------------------------------------------------------------------
function GetTime()
s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")
Date = "Hora local: "..h..":"..m..":"..s.." ? "..d.."/"..mm.."/20"..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
-------------------------------------------------------------------------------------------------------------------------------------------------

Title:
Post by: nErBoS on 06 March, 2004, 17:32:50
Hi,

Done and already translated :) ....

-----------------------------------------------------------------------------
-- 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}

Stattxt = "Stat.txt" --Will be created in the script folder

Stat = {
logins = 0,
share = 0,
users = 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 ttshare = format("%0.2f", tonumber(Stat.share)/(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().." ? v2004 -]=----->")
   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 - Limite minimo: "..frmHub:GetMinShare()/(1024).." 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: [URL]www.lusobrasil.site.vu[/URL]")
   user:SendData(Bot, "      ? Numero M?ximo de Utilizadores recebido: "..Stat.users)
   user:SendData(Bot, "      ? Numero M?ximo de Share recebido: "..ttshare)
   user:SendData(Bot, "      ? Numero de Entradas: "..Stat.logins)
   user:SendData(Bot, "      ? "..GetTime().."")
   user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
   user:SendData(Bot, "      ? Registros sem login no Hub por: 1 semana(s) ser?o auto-removidos. [- Perman?ncia de 5 min. -]")
   user:SendData(Bot, "-=[?]=-----------------------------------------------------------------------------------------------=[?]=-")
end
-------------------------------------------------------------------------------------------------------------------------------------------------
function GetTime()
s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")
Date = "Hora local: "..h..":"..m..":"..s.." ? "..d.."/"..mm.."/20"..y.."."
return Date
end
-------------------------------------------------------------------------------------------------------------------------------------------------
ALLUSERS={}

function NewUserConnected(user)
local s,e,usrshare = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
if (readfrom(Stattxt) == nil) then
if (Stat.users < frmHub:GetUsersCount() ) then
Stat.users = frmHub:GetUsersCount()
else
end
if (Stat.share < frmHub:GetCurrentShareAmount() + usrshare) then
Stat.share = frmHub:GetCurrentShareAmount() + usrshare
end
Stat.logins = Stat.logins + 1
SaveToFile(Stattxt , Stat , "Stat")
else
LoadFromFile (Stattxt)
local logins = Stat["logins"]
local share = Stat["share"]
local users = Stat["users"]
if (users < frmHub:GetUsersCount() ) then
Stat.users = frmHub:GetUsersCount()
else
Stat.users = users
end
if (share < frmHub:GetCurrentShareAmount() + usrshare) then
Stat.share = frmHub:GetCurrentShareAmount() + usrshare
else
Stat.share = share
end
Stat.logins = logins + 1
SaveToFile(Stattxt , Stat , "Stat")
end

   if ALLUSERS[user.sName]==nil then
      ALLUSERS[user.sName]=1
      LEVELS[tostring(user.iProfile)]=LEVELS[tostring(user.iProfile)]+1
   end
   Message(user)
end
-------------------------------------------------------------------------------------------------------------------------------------------------
OpConnected = NewUserConnected

-------------------------------------------------------------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------------------------------------------------------------
function Serialize(tTable, sTableName, hFile, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(hFile, "hFile equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";

write(hFile, sTab..sTableName.." = {\n" );

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
write(hFile, sTab.."\t"..sKey.." = "..sValue);
end

write(hFile, ",\n");
end

write(hFile, sTab.."}");
end

function SaveToFile(file , table , tablename)
local hFile = openfile(file, "w");
Serialize(table, tablename, hFile);
closefile(hFile);
end

function LoadFromFile (file)
assert(readfrom(file),"Making file, not to horry")
dostring(read("*all"))
readfrom()
end

Best regards, nErBoS
Title:
Post by: nEgativE on 07 March, 2004, 22:25:30
ValewWw nErBoS !! :-) Thank U