Record Bot - Page 3
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Record Bot

Started by jiten, 10 May, 2005, 15:38:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jiten

Quote from: Troubadour on 28 February, 2006, 20:53:19
Very nice one jiten.
Could you make it so it displays with the date of record.

example:
<RecordBot> Share record: 22.4 TB set at 26/02/2006
<RecordBot> User record: 216 users 27/02/2006
<RecordBot> Top Sharer: [NL]Koromo (58.2 GB) 22/02/2006
<RecordBot> [NL]Koromo has just raised the all-time share record to: 22.4 TB at 26/02/2006
<RecordBot> [NL]Koromo is our all-time biggest sharer with: 58.2 GB since 22/02/2006 :)
<RecordBot> [OH]NLAngela2 has just raised the all-time user record to: 217 users on 28/02/2006 :)
<RecordBot> [OH]NLAngela2 has just raised the all-time share record to: 22.5 TB on 28/02/2006
<RecordBot> [OH]NLAngela2 is our all-time biggest sharer with: 110.6 GB since 28/02/2006 :)

... I'll do that.

Best regards

Troubadour

Quote
... I'll do that.

Best regards

I do appreciate it allready m8.
Very awesome script.
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

jiten

First post updated with Troubadour's request.

Didn't test it much so, report your progress.

Cheers

Troubadour

Quote from: jiten on 08 March, 2006, 20:03:09
First post updated with Troubadour's request.

Didn't test it much so, report your progress.

Cheers

I'm testing it now, will report the progress here soon!
Thanks m8!
Posted on: 09 March 2006, 18:58:11
As far as i can see at the moment, it rocks!
Just as i wanted it to be.
:)
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

jiten

I'm glad you like it and it's bugless ;)

Best regards

Zeel

First off, let me say that I appreciate your scripts and that I liked your old RecordBot script so much I upgraded to your new one.  Next, I have been having a problem.  For some reason, the user record is messed up.  Right now, there are currently 73 users on my hub but the user record is only at 69 users?   What do I need to do to fix this?  The script reports no errors when loaded.  Thanks again!   

-Z

jiten

Quote from: Zeel on 17 September, 2006, 22:39:12
For some reason, the user record is messed up.  Right now, there are currently 73 users on my hub but the user record is only at 69 users?   What do I need to do to fix this? 

I haven't really changed much in the code for you to have such strange behaviour. However, it could be related to your settings.

Have a look at your ignore table tIgnore. My guess is that you've some entries there and they will surely affect the user record stated by the script.

Cêñoßy†ê

Quote from: Zeel on 17 September, 2006, 22:39:12
For some reason, the user record is messed up.  Right now, there are currently 73 users on my hub but the user record is only at 69 users?   What do I need to do to fix this?  The script reports no errors when loaded.  Thanks again!   

-Z

Remember that script wont count your bots.. your client shows bots as connected users allso ;)
Powered By Leviathan™ 2nd Generation v. 1.9

Zeel

Ok, I think it was just because of the bots.  Thanks for your help everybody!

speedX

Hey jiten, when u had jus made this script tht time i had taken this.....but i have seen tht it has gone under many upgrades.....is it okay if i replace the previous script with this new one?? but i want my old .tbl file only......will I have to make a new .tbl file if i replace the script.....???
Posted on: 18 September 2006, 22:40:01
hope i have not confused u.......i mean to say tht i have this script much b4.....but it has now gone under so many upgrades......can i replace the existing record bot wid me wid this one?? (But i want my old .tbl file only) Is it possible??
Thanking You,

speedX

jiten

Quote from: speedX on 18 September, 2006, 21:40:01
Hey jiten, when u had jus made this script tht time i had taken this.....but i have seen tht it has gone under many upgrades.....is it okay if i replace the previous script with this new one?? but i want my old .tbl file only......will I have to make a new .tbl file if i replace the script.....???

What version of Record Bot are you running?

speedX

Lua 5.1
here is the script....
Quote
--[[

   RecordBot 1.5a - LUA 5.1 by jiten (3/22/2006)

   Based on RecordBot vKryFinal written by bonki 2003

   Description: Logs and displays a hub's all time share and user record.

   - Fixed: Huge users bug and some stuff (thx to T?M??r?V?ll?R)
   - Fixed: Stats sending before MOTD
   - Added: Top Share and Sharer Record (requested by XPMAN)
   - Added: Reg Bot switch (requested by (uk)jay)
   - Fixed: Nil Max Sharer (thx Cosmos)
   - Added: Ignore List (requested by chettedeboeuf)
   - Fixed: User Record Time (11/26/2005)
   - Added: Top Sharer and Share validation delay (requested by chettedeboeuf)
   - Changed: Command Parsing and profile permission structure
   - Fixed: Top Sharer and Share Delay bug (thx to chettedeboeuf)
   - Chaged: Some code rewritten
   - Added: Time/Date to each record message (requested by Troubadour)
   - Changed: Updated to LUA 5.1

]]--

tSettings = {
   -- Bot Name, Mail and Description
   Bot = { sName = "HoPsCoTcHer", sMail = "bonki@no-spam.net", sDesc = "RecordBot - LUA 5 version by jiten" },
   -- RecordBot Database
   fRecord = "tRecord.tbl",
   -- true: Register Automatically, false: don't
   bRegister = true,
   -- Top Sharer and Top Share validation delay in minutes
   iDelay = 0,
   -- Ignore table
   tIgnore = { ["jiten"] = 1, ["yournick"] = 1, },
   -- Commands
   sHelp = "rb.help", sShow = "rb.show", sSetup = "rb.set", sReset = "rb.reset"
}

Record = {
   -- RecordBot DB
   tDB = {},
   -- RecordBot message settings
   tSetup = {
      -- Show report in Main
      main = 0,
      -- Show report in PM
      pm = 0,
      -- Show report on Login
      login = 0
   },
}

-- Delay table (don't change this)
tDelay = {}

Main = function()
   if tSettings.bRegister then frmHub:RegBot(tSettings.Bot.sName, 1, tSettings.Bot.sDesc, tSettings.Bot.sMail) end
   if loadfile(tSettings.fRecord) then dofile(tSettings.fRecord) end;
   SetTimer(1000); StartTimer()
end

ChatArrival = function(user, data)
   local data = string.sub(data,1,-2)
   local s,e,cmd = string.find(data, "%b<>%s+[%!%+](%S+)" )
   if cmd and tCmds[cmd] then
      cmd = string.lower(cmd);
      if tCmds[cmd].tLevels[user.iProfile] then
         return tCmds[cmd].tFunc(user,data), 1
      else
         return user:SendData(tSettings.Bot.sName, "*** Error: You do not have sufficient rights to run that command!"), 1;
      end
   end
end

OnExit = function()
   SaveToFile(Record,"Record",tSettings.fRecord)
end

tCmds = {
   [tSettings.sHelp] =   {
      tFunc = function(user)
         local sMsg = "\r\n\t\r\n\t\t\t\t\t"..tSettings.Bot.sDesc.."\r\n\r\n\t\t\t\tLogs and displays a hub's all"..
         "time share and user record.\r\n\t\r\n\tAvailable Commands:".."\r\n\r\n";
         for cmd, v in pairs(tCmds) do
            if tCmds[cmd].tLevels[user.iProfile] then sMsg = sMsg.."\t!"..cmd.."\t "..v.tDesc.."\r\n"; end
         end
         user:SendData(tSettings.Bot.sName,sMsg);
      end,
      tLevels = {
         [-1] = 1,
         
  • = 1,
             [1] = 1,
             [2] = 1,
             [3] = 1,
             [4] = 1,
             [5] = 1,
          },
          tDesc = "\tDisplays this help message\t\t\t!"..tSettings.sHelp.."",
       },
       [tSettings.sShow] = {
          tFunc = function(user)
             local tTable = Record.tDB
             if next(tTable) then
                local border = string.rep ("-", 100)
                local msg = "\r\n\t"..border.."\r\n\tRecord\t\tValue\t\tDate - Time\n\t"..border.."\r\n"..
                "\tShare\t\t"..(DoShareUnits(tTable.iShare) or 0).." \t\t"..(tTable.tShare or "*not available*")..
                "\r\n\tUsers\t\t"..(tTable.iUsers or 0).." user(s)\t\t"..(tTable.tUsers or "*not available*")..
                "\r\n\tTop Sharer\t"..(tTable.sMaxSharer or "*not available*").." ("..(DoShareUnits(tTable.iMaxSharer) or 0)..
                ")\t"..(tTable.tMaxSharer or "*not available*").."\r\n\t"..border
                user:SendData(tSettings.Bot.sName,msg)
             else
                user:SendData(tSettings.Bot.sName, "*** Error: No records have been saved.")
             end
          end,
          tLevels = {
             [-1] = 1,
             
  • = 1,
             [1] = 1,
             [2] = 1,
             [3] = 1,
             [4] = 1,
             [5] = 1,
          },
          tDesc = "\tShows this hub's all time share and user record\t!"..tSettings.sShow,
       },
       [tSettings.sSetup] = {
          tFunc = function(user, args)
             local s,e,type,flag = string.find(args,"^%S+%s+%S+%s+(%S+)%s+(%S+)")
             if type and Record.tSetup[string.lower(type)] then
                local tTable = { ["enable"] = 1, ["disable"] = 0 }
                if flag and tTable[string.lower(flag)] then
                   Record.tSetup[string.lower(type)] = tTable[string.lower(flag)]
                   user:SendData(tSettings.Bot.sName, "*** Show in "..string.upper(string.sub(type,1,1))..
                   string.lower(string.sub(type,2,string.len(type))).." Mode has been "..flag.."d!");
                end
             else
                user:SendData(tSettings.Bot.sName, "*** Syntax Error: Type !"..tSettings.sSetup.." <login/pm/main> <enable/disable>");
             end
          end,
          tLevels = {
             
  • = 1,
             [5] = 1,
          },
          tDesc = "\tSetup RecordBot\t\t\t\t!"..tSettings.sSetup.." <main/login/pm> <enable/disable>",
       },
       [tSettings.sReset] = {
          tFunc = function(user)
             Record.tDB = {}
             SendToAll(tSettings.Bot.sName, "*** Hub records have been reset!");
          end,
          tLevels = {
             
  • = 1,
             [5] = 1,
          },
          tDesc = "\tResets all records\t\t\t\t!"..tSettings.sReset,
       },
    };

    NewUserConnected = function(user)
       if tSettings.tIgnore[user.sName] ~= 1 then
          local iUserCount, tTable = frmHub:GetUsersCount(), Record.tDB
          tTable.iUsers = tTable.iUsers or 0; tTable.tUsers = tTable.tUsers or "*not available*"
          if (iUserCount > tTable.iUsers) then
             tTable.iUsers = iUserCount; tTable.tUsers = os.date()
             if (Record.tSetup.pm == 1) then
                SendPmToNick(user.sName, "*** Thanks, buddie. You've just raised the all-time share record!");
             end;
             if (Record.tSetup.main == 1) then
                SendToAll(tSettings.Bot.sName, "*** "..user.sName.." has just raised the all-time user record to: "..
                tTable.iUsers.." users at "..os.date().." :)");
             end;
          end
          tDelay[user] = {}
          tDelay[user]["iTime"] = tSettings.iDelay*60
       end
    end

    OpConnected = NewUserConnected

    OnTimer = function()
       for nick,v in pairs(tDelay) do
          tDelay[nick]["iTime"] = tDelay[nick]["iTime"] - 1
          if tDelay[nick]["iTime"] <= 0 then
             if GetItemByName(nick.sName) then
                local iTotalShare, iShare, sNick, tTable = frmHub:GetCurrentShareAmount(), nick.iShareSize, nick.sName, Record.tDB
                tTable.iShare = tTable.iShare or 0
                if (iTotalShare > tTable.iShare) then
                   tTable.iShare = iTotalShare; tTable.tShare = os.date()
                   if (Record.tSetup.pm == 1) then SendPmToNick(nick.sName, tSettings.Bot.sName, "*** Thanks, buddie. You have just raised the all-time share record to "..DoShareUnits(iTotalShare).." :)"); end;
                   if (Record.tSetup.main == 1) then SendToAll(tSettings.Bot.sName, "*** "..nick.sName.." has just raised the all-time share record to: "..DoShareUnits(iTotalShare).." on "..os.date("%x")); end;
                end

                tTable.iMaxSharer = tTable.iMaxSharer or 0
                if (iShare > tTable.iMaxSharer) then
                   tTable.iMaxSharer = iShare; tTable.sMaxSharer = nick.sName; tTable.tMaxSharer = os.date()
                   if (Record.tSetup.pm == 1) then SendPmToNick(nick.sName, "*** Thanks, buddie. You are our highest sharer with: "..DoShareUnits(iShare).."."); end;
                   if (Record.tSetup.main == 1) then SendToAll(tSettings.Bot.sName, "*** "..nick.sName.." is our all-time biggest sharer with: "..DoShareUnits((iShare)).." since "..os.date("%x").." :)");    end;
                end

                if (Record.tSetup.login == 1) then
                   local sMsg = "\r\n\r\n\tShare record: "..(DoShareUnits(tonumber(tTable.iShare)) or 0).." at "..
                   (tTable.tShare or "*not available*").."\r\n\tUser record: "..(tTable.iUsers or 0).." users at "..
                   (tTable.tUsers or "*not available*").."\r\n\tTop Sharer: "..(tTable.sMaxSharer or "*not available*")..
                   " ("..(DoShareUnits(tTable.iMaxSharer) or 0)..") at "..(tTable.tMaxSharer or "*not available*").."\r\n"
                   nick:SendData(tSettings.Bot.sName,sMsg)
                end;
             end
             tDelay[nick] = nil
          end
       end
    end

    -- By kepp and NotRambitWombat
    DoShareUnits = function(intSize)
       if intSize and intSize ~= 0 then
          local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }; intSize = tonumber(intSize);
          local sUnits;
          for index in ipairs(tUnits) do
             if(intSize < 1024) then sUnits = tUnits[index];  break;  else   intSize = intSize / 1024;  end
          end
          return string.format("%0.1f %s",intSize, sUnits);
       end
    end

    Serialize = function(tTable,sTableName,hFile,sTab)
       sTab = sTab or "";
       hFile:write(sTab..sTableName.." = {\n");
       for key,value in pairs(tTable) do
          if (type(value) ~= "function") then
             local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
             if(type(value) == "table") then
                Serialize(value,sKey,hFile,sTab.."\t");
             else
                local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
                hFile:write(sTab.."\t"..sKey.." = "..sValue);
             end
             hFile:write(",\n");
          end
       end
       hFile:write(sTab.."}");
    end

    SaveToFile = function(table,tablename,file)
       local hFile = io.open(file,"w+") Serialize(table,tablename,hFile); hFile:close()
    end
Thanking You,

speedX

jiten

Can you attach your older .tbl and tell me its version?

speedX

i am using Lua 5.1

Here is the .tbl file.
Quote
Record = {
   ["tDB"] = {
      ["iShare"] = 5659333534458,
      ["tShare"] = "09/14/06 22:50:23",
      ["iMaxSharer"] = 508548633146,
      ["iUsers"] = 137,
      ["sMaxSharer"] = "ahandfullofearth",
      ["tMaxSharer"] = "08/28/06 22:21:59",
      ["tUsers"] = "09/12/06 23:11:27",
   },
   ["tSetup"] = {
      ["pm"] = 0,
      ["main"] = 0,
      ["login"] = 0,
   },
}
Thanking You,

speedX

jiten

It shouldn't be a problem then.

You can use your older .tbl with the latest Record Bot version.

achiever

sir i used the first posted script of this available now n i m getting following error
Syntax D:\0.3.5.1.lua5.1.1\scripts\test.lua:181: attempt to call a table value
Syntax D:\0.3.5.1.lua5.1.1\scripts\test.lua:228: attempt to call a table value

plzz can u help. :(
thks,
achiever.

6Marilyn6Manson6

--[[

	RecordBot 1.5 - Lua 5 version by jiten 

	Based on RecordBot vKryFinal written by bonki 2003

	Description: Logs and displays a hub's all time share and user record.

	- Fixed: Huge users bug and some stuff (thx to T?M??r?V?ll?R)
	- Fixed: Stats sending before MOTD
	- Added: Top Share and Sharer Record (requested by XPMAN)
	- Added: Reg Bot switch (requested by (uk)jay)
	- Fixed: Nil Max Sharer (thx Cosmos)
	- Added: Ignore List (requested by chettedeboeuf)
	- Fixed: User Record Time (11/26/2005)
	- Added: Top Sharer and Share validation delay (requested by chettedeboeuf)
	- Changed: Command Parsing and profile permission structure
	- Fixed: Top Sharer and Share Delay bug (thx to chettedeboeuf)
	- Chaged: Some code rewritten
	- Added: Time/Date to each record message (requested by Troubadour)
	--	
	- Converted to Lua 5.1 version by 6Marilyn6Manson6   07/11/2006
]]--

tSettings = {
	-- Bot Name, Mail and Description
	Bot = { sName = "RecordBot", sMail = "bonki@no-spam.net", sDesc = "RecordBot - LUA 5 version by jiten" },
	-- RecordBot Database
	fRecord = "tRecord.tbl",
	-- true: Register Automatically, false: don't
	bRegister = true,
	-- Top Sharer and Top Share validation delay in minutes
	iDelay = 0,
	-- Ignore table
	tIgnore = { ["jiten"] = 1, ["yournick"] = 1, },
	-- Commands
	sHelp = "rb.help", sShow = "rb.show", sSetup = "rb.set", sReset = "rb.reset"
}

Record = { 
	-- RecordBot DB
	tDB = {},
	-- RecordBot message settings
	tSetup = { 
		-- Show report in Main
		main = 1,
		-- Show report in PM
		pm = 0,
		-- Show report on Login
		login = 1
	},
}

-- Delay table (don't change this)
tDelay = {}

Main = function()
	if tSettings.bRegister then frmHub:RegBot(tSettings.Bot.sName, 1, tSettings.Bot.sDesc, tSettings.Bot.sMail) end
	if loadfile(tSettings.fRecord) then dofile(tSettings.fRecord) end;
	SetTimer(1000); StartTimer()
end

ChatArrival = function(user, data)
	local data = string.sub(data,1,-2) 
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+](%S+)" )
	if cmd and tCmds[cmd] then
		cmd = string.lower(cmd);
		if tCmds[cmd].tLevels[user.iProfile] then
			return tCmds[cmd].tFunc(user,data), 1
		else
			return user:SendData(tSettings.Bot.sName, "*** Error: You do not have sufficient rights to run that command!"), 1;
		end
	end
end

OnExit = function()
	SaveToFile(Record,"Record",tSettings.fRecord)
end

tCmds = {
	[tSettings.sHelp] =	{ 
		tFunc = function(user)
			local sMsg = "\r\n\t\r\n\t\t\t\t\t"..tSettings.Bot.sDesc.."\r\n\r\n\t\t\t\tLogs and displays a hub's all"..
			"time share and user record.\r\n\t\r\n\tAvailable Commands:".."\r\n\r\n";
			for cmd, v in ipairs(tCmds) do
				if tCmds[cmd].tLevels[user.iProfile] then sMsg = sMsg.."\t!"..cmd.."\t "..v.tDesc.."\r\n"; end
			end
			user:SendData(tSettings.Bot.sName,sMsg);
		end, 
		tLevels = {
			[-1] = 1,
			[0] = 1,
			[1] = 1,
			[2] = 1,
			[3] = 1,
			[4] = 1,
			[5] = 1,
		},
		tDesc = "\tDisplays this help message\t\t\t!"..tSettings.sHelp.."",
	},
	[tSettings.sShow] = { 
		tFunc = function(user)
			local tTable = Record.tDB
			if next(tTable) then
				local border = string.rep ("-", 100)
				local msg = "\r\n\t"..border.."\r\n\tRecord\t\tValue\t\tDate - Time\n\t"..border.."\r\n"..
				"\tShare\t\t"..(DoShareUnits(tTable.iShare) or 0).." \t\t"..(tTable.tShare or "*not available*")..
				"\r\n\tUsers\t\t"..(tTable.iUsers or 0).." user(s)\t\t"..(tTable.tUsers or "*not available*")..
				"\r\n\tTop Sharer\t"..(tTable.sMaxSharer or "*not available*").." ("..(DoShareUnits(tTable.iMaxSharer) or 0)..
				")\t"..(tTable.tMaxSharer or "*not available*").."\r\n\t"..border
				user:SendData(tSettings.Bot.sName,msg)
			else
				user:SendData(tSettings.Bot.sName, "*** Error: No records have been saved.")
			end
		end,
		tLevels = {
			[-1] = 1,
			[0] = 1,
			[1] = 1,
			[2] = 1,
			[3] = 1,
			[4] = 1,
			[5] = 1,
		},
		tDesc = "\tShows this hub's all time share and user record\t!"..tSettings.sShow,
	},
	[tSettings.sSetup] = {
		tFunc = function(user, args)
			local s,e,type,flag = string.find(args,"^%S+%s+%S+%s+(%S+)%s+(%S+)")
			if type and Record.tSetup[string.lower(type)] then
				local tTable = { ["enable"] = 1, ["disable"] = 0 }
				if flag and tTable[string.lower(flag)] then
					Record.tSetup[string.lower(type)] = tTable[string.lower(flag)]
					user:SendData(tSettings.Bot.sName, "*** Show in "..string.upper(string.sub(type,1,1))..
					string.lower(string.sub(type,2,string.len(type))).." Mode has been "..flag.."d!");
				end
			else
				user:SendData(tSettings.Bot.sName, "*** Syntax Error: Type !"..tSettings.sSetup.." <login/pm/main> <enable/disable>");
			end
		end, 
		tLevels = {
			[0] = 1,
			[5] = 1,
		},
		tDesc = "\tSetup RecordBot\t\t\t\t!"..tSettings.sSetup.." <main/login/pm> <enable/disable>",
	},
	[tSettings.sReset] = {
		tFunc = function(user)
			Record.tDB = {}
			SendToAll(tSettings.Bot.sName, "*** Hub records have been reset!");
		end, 
		tLevels = {
			[0] = 1,
			[5] = 1,
		},
		tDesc = "\tResets all records\t\t\t\t!"..tSettings.sReset,
	},
};

NewUserConnected = function(user)
	if tSettings.tIgnore[user.sName] ~= 1 then
		local iUserCount, tTable = frmHub:GetUsersCount(), Record.tDB
		tTable.iUsers = tTable.iUsers or 0; tTable.tUsers = tTable.tUsers or "*not available*"
		if (iUserCount > tTable.iUsers) then
			tTable.iUsers = iUserCount; tTable.tUsers = os.date()
			if (Record.tSetup.pm == 1) then
				SendPmToNick(user.sName, "*** Thanks, buddie. You've just raised the all-time share record!");
			end;
			if (Record.tSetup.main == 1) then
				SendToAll(tSettings.Bot.sName, "*** "..user.sName.." has just raised the all-time user record to: "..
				tTable.iUsers.." users at "..os.date().." :)");
			end;
		end
		tDelay[user] = {}
		tDelay[user]["iTime"] = tSettings.iDelay*60
	end
end

OpConnected = NewUserConnected

OnTimer = function()
	for nick,v in ipairs(tDelay) do
		tDelay[nick]["iTime"] = tDelay[nick]["iTime"] - 1
		if tDelay[nick]["iTime"] <= 0 then
			if GetItemByName(nick.sName) then
				local iTotalShare, iShare, sNick, tTable = frmHub:GetCurrentShareAmount(), nick.iShareSize, nick.sName, Record.tDB
				tTable.iShare = tTable.iShare or 0
				if (iTotalShare > tTable.iShare) then
					tTable.iShare = iTotalShare; tTable.tShare = os.date()
					if (Record.tSetup.pm == 1) then SendPmToNick(nick.sName, tSettings.Bot.sName, "*** Thanks, buddie. You have just raised the all-time share record to "..DoShareUnits(iTotalShare).." :)"); end;
					if (Record.tSetup.main == 1) then SendToAll(tSettings.Bot.sName, "*** "..nick.sName.." has just raised the all-time share record to: "..DoShareUnits(iTotalShare).." on "..os.date("%x")); end;
				end

				tTable.iMaxSharer = tTable.iMaxSharer or 0
				if (iShare > tTable.iMaxSharer) then
					tTable.iMaxSharer = iShare; tTable.sMaxSharer = nick.sName; tTable.tMaxSharer = os.date()
					if (Record.tSetup.pm == 1) then SendPmToNick(nick.sName, "*** Thanks, buddie. You are our highest sharer with: "..DoShareUnits(iShare).."."); end;
					if (Record.tSetup.main == 1) then SendToAll(tSettings.Bot.sName, "*** "..nick.sName.." is our all-time biggest sharer with: "..DoShareUnits((iShare)).." since "..os.date("%x").." :)"); 	end;
				end

				if (Record.tSetup.login == 1) then
					local sMsg = "\r\n\r\n\tShare record: "..(DoShareUnits(tonumber(tTable.iShare)) or 0).." at "..
					(tTable.tShare or "*not available*").."\r\n\tUser record: "..(tTable.iUsers or 0).." users at "..
					(tTable.tUsers or "*not available*").."\r\n\tTop Sharer: "..(tTable.sMaxSharer or "*not available*")..
					" ("..(DoShareUnits(tTable.iMaxSharer) or 0)..") at "..(tTable.tMaxSharer or "*not available*").."\r\n"
					nick:SendData(tSettings.Bot.sName,sMsg)
				end;
			end
			tDelay[nick] = nil
		end
	end
end

-- By kepp and NotRambitWombat 
DoShareUnits = function(intSize)
	if intSize and intSize ~= 0 then 
		local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }; intSize = tonumber(intSize); 
		local sUnits; 
		for index in ipairs(tUnits) do 
			if(intSize < 1024) then sUnits = tUnits[index];  break;  else   intSize = intSize / 1024;  end 
		end 
		return string.format("%0.1f %s",intSize, sUnits);
	end 
end

Serialize = function(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n");
	for key,value in ipairs(tTable) do
		if (type(value) ~= "function") then
			local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
			if(type(value) == "table") then
				Serialize(value,sKey,hFile,sTab.."\t");
			else
				local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
				hFile:write(sTab.."\t"..sKey.." = "..sValue);
			end
			hFile:write(",\n");
		end
	end
	hFile:write(sTab.."}");
end

SaveToFile = function(table,tablename,file)
	local hFile = io.open(file,"w+") Serialize(table,tablename,hFile); hFile:close() 
end

achiever

yup  :D
thks a lot, working properly. :)

bye,

achiever
thks,
achiever.

jiten

Quote from: achiever on 07 November, 2006, 09:09:29
sir i used the first posted script of this available now n i m getting following error
Syntax D:\0.3.5.1.lua5.1.1\scripts\test.lua:181: attempt to call a table value
Syntax D:\0.3.5.1.lua5.1.1\scripts\test.lua:228: attempt to call a table value

plzz can u help. :(


You're getting these errors because I haven't updated the script to LUA 5.1 yet. I'll do it as soon as possible.

Though, 6M6M6 has already done a quick conversion. Thanks for that.

6Marilyn6Manson6

Quote from: jiten on 07 November, 2006, 19:02:38
You're getting these errors because I haven't updated the script to LUA 5.1 yet. I'll do it as soon as possible.

Though, 6M6M6 has already done a quick conversion. Thanks for that.

No problem jiten :)

jiten

As requested, I've updated this script to LUA 5.1. Please check in its Finished Scripts section.

IMPORTANT: I've changed the database structure in the version, so, you must delete your existing .tbl so that the script can work properly.

If needed, I'll post a converter.

speedX

Quote from: jiten on 08 November, 2006, 14:38:20
If needed, I'll post a converter.
plzz, coz I cant delete my old one
Thanking You,

speedX

jiten

Here you go then:

--[[ 

	RecordBot 1.5a to 1.6 DB Converter by jiten (11/8/2006)

	Requested by: speedX

	CHANGELOG:

	1. Place your old tRecord.tbl under your scripts' folder;
	2. Run this script and the new file "tRecord(new).tbl" will appear in the same folder;
	3. Backup your old DB (just in case) and rename the new one to the default format: tRecord.tbl
	4. And that's it!

]]--

-- File to convert
fConvert = "tRecord.tbl"
-- Output file
fConverted = "tRecord(new).tbl"

tConvert = {}

Main = function()
	if loadfile(fConvert) then dofile(fConvert) end; tConvert = Record.tDB
	local hFile = io.open(fConverted, "w+") Serialize(tConvert, "tRecord", hFile); hFile:close() 
end

Serialize = function(tTable, sTableName, hFile, sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n");
	for key, value in pairs(tTable) do
		if (type(value) ~= "function") then
			local sKey = (type(key) == "string") and string.format("[%q]", key) or string.format("[%d]", key);
			if(type(value) == "table") then
				Serialize(value, sKey, hFile, sTab.."\t");
			else
				local sValue = (type(value) == "string") and string.format("%q", value) or tostring(value);
				hFile:write(sTab.."\t"..sKey.." = "..sValue);
			end
			hFile:write(",\n");
		end
	end
	hFile:write(sTab.."}");
end

SMF spam blocked by CleanTalk