READ THE RULES
0 Members and 3 Guests are viewing this topic.
--## Simple Time Bot--## Requested by SteffJay --## Made by nErBoS--## Converted in LUA 5 by 6Marilyn6Manson6--## Commands:--## !time - Gives the current timesBot = "Time-Bot"function ChatArrival(user, data) if (string.sub(data,1,1)=="<") or (string.sub(data,1,5+string.len(sBot))=="$To: "..sBot) then data = string.sub(data,1,string.len(data)-1) s,e,cmd = string.find(data,"%b<>%s+(%S+)") if (cmd == "!time") then user:SendData(sBot, GetTime()) end endendfunction GetTime() f = os.date("%p") s = os.date("%S") h = os.date("%l") m = os.date("%M") d = os.date("%d") mm = os.date("%m") y = os.date("%y") Date = "Date: "..d.."/"..mm.."/20"..y.." Time: "..h..":"..m..":"..s.." "..f return Dateend
hey 6M6M6 thx for the help.....but ur script was showing me wrong time.....for 9:52 AM it was showing 00:42 AM .......i donno tht it is problem in script or frm side coz i was in a hurry......
0 month(s), 9 day(s), 11 hour(s), 21 minute(s) 10460 min 09/06/06 20:50:24 09/06/06 21:35:56 Cool Member *Online* SHEVCHENKO7and0 month(s), 7 day(s), 5 hour(s), 34 minute(s) 5122 min 09/23/06 07:44:01 09/23/06 07:42:06 Cool Member *Online* ShEvChEnKo7
hey jiten.....this tophubbers doesnt give result if the nick is given in small......like for BLITZKRIEG if i type !hubtime blitzkrieg...it shows nick not found.....and one user in my hub had first logged in with nick ShEvChEnKo7 and thn later SHEVCHENKO7 so there has been a double entry for this guy......so now wat to do ??
You have to use the actual nick [case must match] else there are hub calls made and user objects used that might fail with improper case. Often it's fine to match in lower case. This is not one of those times.
scripts\tophub.lua:86: attempt to compare number with nil
[13:08] Syntax ...der\PtokaX DC Hub 0.3.5.2\scripts\TopHubbers2.01.lua:311: 'string.gfind' was renamed to 'string.gmatch'
Hey jiten,this script is showing me the following error in Ptokax 0.3.5.2
I'm using tophubbers (old version TopHubbers 1.21) with PX 0.3.5.2 and it's working fine, no errors.
But the version wich u r using, does it have all the commands of v2.01 ?? If yes thn plzz attach the script.
Hey jiten,this script is showing me the following error in Ptokax 0.3.5.2Quote[13:08] Syntax ...der\PtokaX DC Hub 0.3.5.2\scripts\TopHubbers2.01.lua:311: 'string.gfind' was renamed to 'string.gmatch'
hi,sir this script is giving me error[16:06] Syntax D:\ptokax\scripts\TopHubbers2.01.lua:328: attempt to perform arithmetic on local `iSeconds' (a nil value)n its not showing me right click menualso not showing my average hubtimen the average hubtime of others also is the same as their session time
Added: iLoginTime to userobject in lua.
TopHubbers2.01.lua:226: attempt to compare two nil values
hi jiten, wen i type !tophubbers the foll error comes:Code: [Select]TopHubbers2.01.lua:226: attempt to compare two nil values
Can you make a convertor or something wich will delete users having more than one account??plzz if possible or shud I delete thm manually?
--[[ TopHubbers 2.01-2.02 DB Converter by jiten (11/11/2006) Requested by: speedX DESCRIPTION: This converter will keep the oldest repeated entry in the DB and delete the others. STEPS: 1. Place your old tOnliners.tbl under your scripts' folder; 2. Run this script and the new file "tOnliners(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: tOnliners.tbl 4. And that's it!]]---- File to convertfConvert = "tOnliners.tbl"-- Output filefConverted = "tOnliners(new).tbl"Main = function() if loadfile(fConvert) then dofile(fConvert) end; local tConvert, tRemove = tOnline, {} for i, v in pairs(tConvert) do tRemove[string.lower(i)] = (tRemove[string.lower(i)] or {}) table.insert(tRemove[string.lower(i)], v.Julian); table.sort(tRemove[string.lower(i)]) while #tRemove[string.lower(i)] > 1 do table.remove(tRemove[string.lower(i)], #tRemove[string.lower(i)]) end end for i, v in pairs(tConvert) do if tRemove[string.lower(i)] then if tRemove[string.lower(i)][1] < v.Julian then tConvert[i] = nil end end end local hFile = io.open(fConverted, "w+") Serialize(tConvert, "tOnline", hFile); hFile:close() endSerialize = 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
For example: I wanna c hubtime of a nick AdminsTrator........ and if i type +hubtime admins thn it will show the output........
But I'm facing one problem. After running the script a new .tbl is formed named "tOnliners(new).tbl" and after renaming it to "tOnliners.tbl" it doesnt work
hubtime's function should be like this:Code: [Select]fFunction = function(user, data) -- Parse nick local _,_, nick = string.find(data, "^%S+%s+(%S+)$") -- Exists if nick then -- Return SendToAll(user.sName, data) BuildStats(user, nick) else user:SendMessage(tSettings.sBot, "*** Syntax Error: Type !hubtime <nick>") endend,You'll also need to replace your BuildStats function with this one:Code: [Select]BuildStats = function(user, nick) -- In DB if tOnline[nick] then -- Average uptime in days local iAverage = os.difftime(os.time(os.date("!*t")), tOnline[nick].Julian)/(60*60*24) if iAverage < 1 then iAverage = 1 end -- Generate message local sMsg = "\r\n\r\n\t"..string.rep("=", 40).."\r\n\t\t\tStats:\r\n\t".. string.rep("-", 80).."\r\n\t- Nick: "..nick.."\r\n\t- Total uptime: ".. MinutesToTime(tOnline[nick].TotalTime, true).."\r\n\t- Daily average uptime: ".. MinutesToTime((tOnline[nick].TotalTime/iAverage), true).."\r\n\t- Current Rank: "..GetRank(nick).."\r\n" -- Send stats SendToAll(tSettings.sBot, sMsg) else user:SendMessage(tSettings.sBot, "*** Error: No record found for '"..nick.."'!") endendNotice that with these changes, if you've enabled the 'bRankOnConnect' option, every user's mainchat will be flooded with connecting users' stats. So, be careful.
fFunction = function(user, data) -- Parse nick local _,_, nick = string.find(data, "^%S+%s+(%S+)$") -- Exists if nick then -- Return SendToAll(user.sName, data) BuildStats(user, nick) else user:SendMessage(tSettings.sBot, "*** Syntax Error: Type !hubtime <nick>") endend,
BuildStats = function(user, nick) -- In DB if tOnline[nick] then -- Average uptime in days local iAverage = os.difftime(os.time(os.date("!*t")), tOnline[nick].Julian)/(60*60*24) if iAverage < 1 then iAverage = 1 end -- Generate message local sMsg = "\r\n\r\n\t"..string.rep("=", 40).."\r\n\t\t\tStats:\r\n\t".. string.rep("-", 80).."\r\n\t- Nick: "..nick.."\r\n\t- Total uptime: ".. MinutesToTime(tOnline[nick].TotalTime, true).."\r\n\t- Daily average uptime: ".. MinutesToTime((tOnline[nick].TotalTime/iAverage), true).."\r\n\t- Current Rank: "..GetRank(nick).."\r\n" -- Send stats SendToAll(tSettings.sBot, sMsg) else user:SendMessage(tSettings.sBot, "*** Error: No record found for '"..nick.."'!") endend