May not be very efficient / optimized, but it does the job. :)
*** Edit, not quite updated for new ptokaX. Needs XML handling doing. Is this done the same way as in DC++ or differently. a LUA script which shows XML handleing being done, would make it quite a bit easier.
-- auto/manual registered user cleaner if user hasn't been in the hub for x weeks
-- made by plop
-- julian day function made by the guru tezlo
-- code stripped from artificial insanety bot
-- updated to LUA 5 by Pothead
-- !noclean add/remove - adds/removes users from/to the list which aren't cleaned
-- !showusers - shows all registered users
-- !seen - shows the last time the user left the hub
-- !shownoclean - shows all names wich are on the noclean list
-- !cleanusers - manualy start the usercleaner
--------------------------------------------------------------------- config
WEEKS = 2 -- every1 older then x weeks is deleted
Bot = frmHub:GetHubBotName()
AUTO = 0 -- use 1 for automode, 0 for manual
CleanLevels = {[3]=1} -- levels it needs 2 clean
--------------------------------------------------------------------- the needed tables
UsersTable = {}
Seen = {}
NoClean = {}
--------------------------------------------------------------------- julian day function 2 calcute the time users spend in the hub
function jdate(d, m, y)
local a, b, c = 0, 0, 0
if m <= 2 then
y = y - 1
m = m + 12
end
if (y*10000 + m*100 + d) >= 15821015 then
a = math.floor(y/100)
b = 2 - a + math.floor(a/4)
end
if y <= 0 then c = 0.75 end
return math.floor(365.25*y - c) + math.floor(30.6001*(m+1) + d + 1720994 + b)
end
--------------------------------------------------------------------- loading the last seen database
function LoadLastSeen()
filename = "../logs/lastseen.lst"
if not io.open(filename, "r") then
local File = io.open( filename, "w" );
File:flush();
File:close();
end
local file = io.open(filename, "r") -- "r" read
for line in file:lines() do
local s,e,name,date = string.find(line, "(.+)$(.+)")
if name ~= nil then
Seen[name]=date
end
end
file:flush()
file:close()
end
--------------------------------------------------------------------- saving last seen date
function SaveSeen()
filename = "../logs/lastseen.lst"
local file = io.open(filename, "w+") -- "w" write
for a,b in Seen do
Seen[a]=b
file:write(a.."$"..b.."\n")
end
file:flush()
file:close()
end
--------------------------------------------------------------------- call the garbage man
function Clear()
collectgarbage()
end
--------------------------------------------------------------------- opening the registered users file from ptokax and inserting the users into the table
function OpenRegisterdUsersFile()
filename = "../cfg/RegisteredUsers.xml"
UsersTable = nil
Clear()
UsersTable = {}
local file = io.open(filename, "r") -- "r" read
for line in file:lines() do
local name, level
s,e,name,level = string.find(line,"(.+)|.+|(.+)")
if CleanLevels[tonumber(level)] then
UsersTable[name] = 1
end
end
file:flush()
file:close()
end
--------------------------------------------------------------------- extracting the time/date when a user was last seen from the database
function SeenUser(user, data)
s,e,who = string.find(data, "%b<>%s%S+%s(.+)")
if who == nil then
user:SendPM(Bot, "Syntax error, can't read your mind, pls tell me wich user you wanne check|")
elseif Seen[who] then
user:SendPM(Bot, who.." was last seen on: "..Seen[who].."|")
else
user:SendPM(Bot, who.." is a unknown user|")
end
end
--------------------------------------------------------------------- shows all the nicks of all registered users
function NewShowUsers(user)
local lines = {}
local info = "\r\n\r\n"
info = info.." Here are the registered users\r\n"
info = info.."=====================================\r\n"
for a,b in UsersTable do
table.insert(lines, a)
end
table.sort(lines)
for i=1,table.getn(lines) do
info = info.." "..lines[i].."\r\n"
end
info = info.."=====================================\r\n"
user:SendPM(Bot, info.." |")
Clear()
end
--------------------------------------------------------------------- shows all the nicks on the no clean list
function ShowNoClean(user)
local lines = {}
local info = "\r\n\r\n"
info = info.." Here are the users who aren't cleaned\r\n"
info = info.."=====================================\r\n"
for a,b in NoClean do
table.insert(lines, a)
end
table.sort(lines)
for i=1,table.getn(lines) do
info = info.." "..lines[i].."\r\n"
end
info = info.."=====================================\r\n"
user:SendPM(Bot, info.." |")
Clear()
end
--------------------------------------------------------------------- cleanup old users
function CleanUsers()
SendToAll(Bot, "The cleaner has been called. Every registered user who hasn't been in the hub for "..WEEKS.." weeks will be deleted. (contact the OP's if your gone be away for a period longer then that)|")
OpenRegisterdUsersFile()
local s,e,month,day,year = string.find(os.date("%x"), "(%d+)%/(%d+)%/(%d+)")
year = "20"..year
local juliannow = jdate(tonumber(day), tonumber(month), tonumber(year))
local oldest = WEEKS*7
local Count2,Count = 0,0
for a,b in UsersTable do
Count = Count+1
if Seen[a] then
if NoClean[a]== nil then
local s,e,monthu,dayu,yearu = string.find(Seen[a], "(%d+)%/(%d+)%/(%d+)")
yearu = "20"..yearu
local julianu = jdate(tonumber(dayu), tonumber(monthu), tonumber(yearu))
if (juliannow - julianu) > oldest then
Count2 = Count2 +1
Seen[a] = nil
DelRegUser(a)
end
end
else
Seen[a] = os.date("%x")
end
end
if Count ~= 0 then
SendToAll(Bot, Count.." users were procest, "..Count2.." of them were deleted.|")
end
SaveSeen()
OpenRegisterdUsersFile()
end
--------------------------------------------------------------------- don't clean this users adding/removing
function NoCleanUser(user, data)
local s,e,who, addrem = string.find(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)%s*")
if (who or addrem) == nil then
user:SendData(Bot, "RTFM ;). it's !noclean |")
elseif UsersTable[who] then
if addrem == "add" then
if NoClean[who] then
user:SendData(Bot, who.." is allready on the imune list.|")
else
NoClean[who] = 1
user:SendData(Bot, who.." is added to the imune list and won't be cleaned.|")
SaveNoClean()
end
elseif addrem == "remove" then
if NoClean[who] then
NoClean[who] = nil
user:SendData(Bot, who.." is removed from the imune list.|")
SaveNoClean()
else
user:SendData(Bot, who.." was not on the imune list.|")
end
else
user:SendData(Bot, "RTFM ;). it's !noclean |")
end
else
user:SendData(Bot, who.." isn't a registered user.|")
end
end
--------------------------------------------------------------------- saving last seen date
function SaveNoClean()
filename = "../logs/noclean.lst"
local file = io.open(filename, "w+") -- "w" write
for a,b in NoClean do
file:write(a.."\n")
end
file:flush()
file:close()
end
--------------------------------------------------------------------- load no clean users from file
function LoadNoClean()
filename = "../logs/noclean.lst"
if not io.open(filename, "r") then
local File = io.open( filename, "w" );
File:flush();
File:close();
end
local file = io.open(filename, "r") -- "r" read
for line in file:lines() do
NoClean[line] = 1
end
file:flush()
file:close()
end
--------------------------------------------------------------------- do i need 2 explain this ?????
function ChatArrival(user, data)
if AUTO == 1 then
if CleanDay ~= os.date("%x") then -- user cleaning trigger, works as a timer without a timer
CleanDay = os.date("%x")
CleanUsers()
end
end
if( string.sub(data, 1, 1) == "<" ) then
if user.bOperator then
data=string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd == "!noclean" then
NoCleanUser(user, data)
return 1
elseif cmd == "!showusers" then
NewShowUsers(user)
return 1
elseif cmd == "!shownoclean" then
ShowNoClean(user)
return 1
elseif cmd == "!seen" then
SeenUser(user, data)
return 1
elseif cmd =="!cleanusers" then
CleanUsers()
return 1
end
end
end
end
--------------------------------------------------------------------- stuff done when a user/vip leaves
function UserDisconnected(user)
if UsersTable[user.sName] then
Seen[user.sName]=os.date("%x")
SaveSeen()
end
end
--------------------------------------------------------------------- do the same stuff for op's if needed
function OpDisconnected(user)
if UsersTable[user.sName] then
Seen[user.sName]=os.date("%x")
SaveSeen()
end
end
--------------------------------------------------------------------- stuff done on bot startup
function Main()
OpenRegisterdUsersFile()
LoadNoClean()
LoadLastSeen()
CleanDay = os.date("%x")
end
thanks ..
k ..
little bug i found ..
when i do !cleanusers ..
bug has disapeared :0)
& great thanks work
* edit first thing was my mistake ..
* edit the second thing is a mystery to me but, now is no more..
QuoteOriginally posted by UwV
k ..
little bug i found ..
when i do !cleanusers ..
those that are not cleaned .. get a new date in lastseen.lst set to "date/last/cleaned" so they would never get cleaned this way ..)
but.. almost right .. :0)
& great work
* edit the other thing was my mistake ..
So it works or not ?( Because when i just tested this, it seems fine to me ?(
excuse me ..
i dont know ..
i have rebooted my hub and it works fine now..
guess was something not to do with this script ..
but for some reason the thing i deleted above happened..
ok Pothead i seen that script, and it looks great but is it posible for you to transphere the next script to lua 5 for me, my thnak will be verry big man
------------------------------------------------------------
-- Show All Registered Users
-- By NightLitch 2003
-- Modded By [fow]CCCL-NL on 27.05.2004
-- Adapted for RoboCop V9.0
--
-- Command: !crew
-- Command: !showlevel
------------------------------------------------------------
BotName = "==TeamBot=="
function Main()
-- frmHub:RegBot(BotName)
end
------------------------------------------------------------
NAMES = {
["reg"] = "\r\n\t Current Registered Users",
["vip"] = "\r\n\t Current Registered Vips",
["operator"] = "\r\n\t CurrentRegistered Operators",
["moderator"] = "\r\n\t Current Registered Moderators",
["master"] = "\r\n\t Current Registered Owner",
["owner"] = "\r\n\t Current Registered Owner",
["netfounder"] = "\r\n\t Current Registered NetworkFounder"
}
function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
data = strsub(data, 1, (strlen(data)-1))
local s, e, cmd, args = strfind(data, "^%b<>%s%!(%a+)%s*(.*)")
if not s then return end
cmd = strlower(cmd)
if (cmd=="crew") then
Msg = "\r\n"
ShowRegistered()
curUser:SendPM(BotName, Msg)
return 1
elseif cmd == "showlevel" then
Msg = "\r\n"
ViewRegs(args)
curUser:SendPM(BotName, Msg)
return 1
end
end
function ShowRegistered()
ViewRegs("NetFounder")
ViewRegs("MASTER")
ViewRegs("MODERATOR")
ViewRegs("OPERATOR")
ViewRegs("VIP")
ViewRegs("REG")
Msg = Msg.."\r\n\tEnd of List"
end
function ViewRegs(Level)
table = nil
if tonumber(Level) then
if GetProfileName(Level) then
Level = GetProfileName(Level)
table = GetUsersByProfile(Level)
end
else
table = GetUsersByProfile(Level)
end
if type(table) == "table" then
local temp = {}
for index, names in table do
tinsert(temp, names)
end
sort(temp)
if getn(temp) == 0 then
Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
else
Msg = Msg.."\r\n>>=====================================<<"
Msg = Msg..NAMES[strlower(Level)]
Msg = Msg.."\r\n>>=====================================<<\r\n"
for i=1,getn(temp) do
local _,_,ProfileName = strfind(temp,"(%S+)")
if GetItemByName(ProfileName) then
Msg = Msg.." "..i.."\t Online\t"..ProfileName.."\r\n"
else
Msg = Msg.." "..i.."\tOffline\t\t"..ProfileName.."\r\n"
end
end
Msg = Msg..">>=====================================<<\r\n"
end
else
Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
end
end
it show up like the next lines.
<==TeamBot==>
>>=====================================<<
Current Registered NetworkFounder
>>=====================================<<
1 Online [fow]CCCL-NL
2 Offline [fow]honda
3 Offline [fow]honda-test
>>=====================================<<
>>=====================================<<
Current Registered Owner
>>=====================================<<
1 Offline [fow]-Cleaner
2 Offline [fow][Mas]iemie
3 Online [fow]iemie
4 Offline [fow]only-for-testing
>>=====================================<<
and so on.
-- Show All Registered Users
-- By NightLitch 2003
-- Modded By [fow]CCCL-NL on 27.05.2004
-- Adapted for RoboCop V10
-- Updated to LUA 5 by Pothead
--
-- Command: !crew
-- Command: !showlevel
------------------------------------------------------------
BotName = frmHub:GetHubBotName()
------------------------------------------------------------
NAMES = {
["reg"] = "\r\n\t Current Registered Users",
["vip"] = "\r\n\t Current Registered Vips",
["operator"] = "\r\n\t CurrentRegistered Operators",
["moderator"] = "\r\n\t Current Registered Moderators",
["master"] = "\r\n\t Current Registered Owner",
["owner"] = "\r\n\t Current Registered Owner",
["netfounder"] = "\r\n\t Current Registered NetworkFounder"
}
function ChatArrival(curUser, data)
if (string.sub(data,1,1) == "<" or string.sub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = string.sub(data,1,string.len(data)-1)
local s, e, cmd, args = string.find(data, "^%b<>%s%!(%a+)%s*(.*)")
if not s then return end
cmd = string.lower(cmd)
if (cmd=="crew") then
Msg = "\r\n"
ShowRegistered()
curUser:SendPM(BotName, Msg)
return 1
elseif cmd == "showlevel" then
Msg = "\r\n"
ViewRegs(args)
curUser:SendPM(BotName, Msg)
return 1
end
end
end
function ShowRegistered()
ViewRegs("NetFounder")
ViewRegs("Master")
ViewRegs("Moderator")
ViewRegs("Operator")
ViewRegs("Vip")
ViewRegs("Reg")
Msg = Msg.."\r\n\tEnd of List"
end
function ViewRegs(Level)
tables = nil
if tonumber(Level) then
if GetProfileName(Level) then
Level = GetProfileName(Level)
tables = GetUsersByProfile(Level)
end
else
tables = GetUsersByProfile(Level)
end
if type(tables) == "table" then
local temp = {}
for index, names in tables do
table.insert(temp, names)
end
table.sort(temp)
if table.getn(temp) == 0 then
Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
else
Msg = Msg.."\r\n>>=====================================<<"
Msg = Msg..NAMES[string.lower(Level)]
Msg = Msg.."\r\n>>=====================================<<\r\n"
for i=1,table.getn(temp) do
local _,_,ProfileName = string.find(temp[i],"(%S+)")
if GetItemByName(ProfileName) then
Msg = Msg.." "..i.."\t Online\t"..ProfileName.."\r\n"
else
Msg = Msg.." "..i.."\tOffline\t\t"..ProfileName.."\r\n"
end
end
Msg = Msg..">>=====================================<<\r\n"
end
else
Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
end
end
Whow man i like this speedy service.
great thanks from the whole fow community.
But im wondering if you could do an other one for me sir?
------------------------------------------------------------------------------
Bot = "newyear"
--This the date the timer has 2 stop @ midnight
-- year (2 numbers), month, day
SylYear,SylMonth,SylDay = 05,12,31
-- this is the file 2 be shown
file = "happynewyear.txt"
------------------------------------------------------------------------------
------------------------------------------------------------------------------
function OnTimer()
if last == 0 then
SendToAll(Bot, TimeLeft())
Sync()
elseif last == 1 then
SendAscii() -- send the msg
StopTimer() -- kill the timer
end
end
------------------------------------------------------------------------------
function jdatehms(d, m, y,ho,mi,se)
local a, b, c = 0, 0, 0
if m <= 2 then
y = y - 1
m = m + 12
end
if (y*10000 + m*100 + d) >= 15821015 then
a = floor(y/100)
b = 2 - a + floor(a/4)
end
if y <= 0 then c = 0.75 end
return floor(365.25*y - c) + floor(30.6001*(m+1) + d + 1720994 + b),ho*3600+mi*60+se
end
------------------------------------------------------------------------------
function TimeLeft()
local curday,cursec = jdatehms(tonumber(date("%d")),tonumber(date("%m")),tonumber(date("%y")),tonumber(date("%H")),tonumber(date("%M")),tonumber(date("%S")))
local sylday,sylsec = jdatehms(SylDay,SylMonth,SylYear,24,0,0)
local tmp = sylsec-cursec
local hours, minutes,seconds = floor(mod(tmp/3600, 60)), floor(mod(tmp/60, 60)), floor(mod(tmp/1, 60))
local day = sylday-curday
if day >= 0 then
line = "Time left till new year:"
if day ~= 0 then
line = line.." "..day.." Day's"
end
if hours ~= 0 then
line = line.." "..hours.." Hours"
end
if minutes ~= 0 then
line = line.." "..minutes.." Minutes"
end
if seconds ~= 0 then
line = line.." "..seconds.." Seconds"
end
return line
else
return 1
end
end
------------------------------------------------------------------------------
function ShowAscii()
text ="\r\n\r\n"
readfrom(file)
while 1 do
local line = read()
if line == nil then
readfrom()
break
end
text = text..line.."\r\n"
end
end
------------------------------------------------------------------------------
function SendAscii()
SendToAll(Bot, text.." |")
SendToAll(Bot, "THe Netfounders/Owners/Operators From The >> FOW-NETWORK << Wiish You All A Happy Newyear|")
end
------------------------------------------------------------------------------
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "!daysleft" then
local tmp = TimeLeft()
if tonumber(tmp) == nil then
user:SendData(Bot, tmp.."|")
end
return 1
end
end
end
------------------------------------------------------------------------------
function NewUserConnected(user)
local tmp = TimeLeft()
if tonumber(tmp) == nil then
user:SendData(Bot, tmp.."|")
end
end
------------------------------------------------------------------------------
function OpConnected(user)
local tmp = TimeLeft()
if tonumber(tmp) == nil then
user:SendData(Bot, tmp.."|")
end
end
------------------------------------------------------------------------------
function Main()
SetTimer(100 * 1000)
StartTimer()
local tmp = TimeLeft()
if tonumber(tmp) == nil then
SendToAll(Bot, tmp.."|")
end
Sync()
ShowAscii()
last = 0
end
------------------------------------------------------------------------------
function Sync()
local curday,cursec = jdatehms(tonumber(date("%d")),tonumber(date("%m")),tonumber(date("%y")),tonumber(date("%H")),tonumber(date("%M")),tonumber(date("%S")))
local sylday,sylsec = jdatehms(SylDay,SylMonth,SylYear,24,0,0)
local tmp = sylsec-cursec
local hours, minutes,seconds = floor(mod(tmp/3600, 60)), floor(mod(tmp/60, 60)), floor(mod(tmp/1, 60))
local day = sylday-curday
if day ~= 0 then
adjust = (floor(mod(minutes, 60))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(3600 * 1000)
end
else
if tmp > 3600 then --- every hours a msg
adjust = (floor(mod(minutes, 60))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(3600 * 1000)
end
elseif tmp > 900 then -- every 15 mins a msg
adjust = (floor(mod(minutes, 15))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(900 * 1000)
end
elseif tmp > 300 then -- every 5 mins a msg
adjust = (floor(mod(minutes, 5))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(300 * 1000)
end
elseif tmp > 60 then -- every min a msg
adjust = (floor(mod(minutes, 1))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(60 * 1000)
end
elseif tmp > 15 then -- every 15 secs a msg
adjust = floor(mod(seconds, 15))
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(15 * 1000)
end
elseif tmp > 10 then -- every 10 secs a msg
adjust = floor(mod(seconds, 10))
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(5 * 1000)
end
elseif tmp > 1 then
SetTimer(1 * 1000)
else
last = 1
SetTimer(1 * 1000)
end
end
end
------------------------------------------------------------------------------
thanks again in advance sir
About regcleaner after 4 reboots and 5 days running there stil no users in tbl file last seen ???
Greetz TiMeTrAVelleR
Open it in notepad, or a text editor. Goto Edit \ Replace . . .
Find: DataArrival --> Replace: ChatArrival
Find: floor ---> Replace: math.floor
Find: date --> Replace: os.date
Find: mod --> Replace: math.mod
Find: str --> Replace: string.
(do not forget the . (fullstop))
Then Replace function ShowAscii()
text ="\r\n\r\n"
readfrom(file)
while 1 do
local line = read()
if line == nil then
readfrom()
break
end
text = text..line.."\r\n"
end
end
with function ShowAscii()
text ="\r\n\r\n"
local file = io.open(file, "r") -- "r" read
for line in file:lines() do
text = text..line.."\r\n"
end
file:flush()
file:close()
end
QuoteOriginally posted by T?M??r?V?ll?R
About regcleaner after 4 reboots and 5 days running there stil no users in tbl file last seen ???
Greetz TiMeTrAVelleR
Put it on Auto. Or run !cleanusers. :)
This part you change to how you want it to run.
WEEKS = 2 -- every1 older then x weeks is deleted
AUTO = 0 -- use 1 for automode, 0 for manual
CleanLevels = {[3]=1} -- levels it needs 2 clean
whow man again thanks for your fast service,
maybe you got time to do one last one for me
--100% Blocker by chill
--Table Load and Save (added by nErBoS)
sBot = "[fow]-Leech"
cmd1 = "!block"
cmd2 = "!unblock"
cmd3 = "!laatzien"
BlockedNicks = {}
fBlock = "block.dat"
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using Ptokax Version 0.3.3.0 or higher
-- Choose 1 if you are using Ptokax Version lower then 0.3.3.0
--## END ##--
function Main()
-- frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(fBlock)
end
function OnExit()
SaveToFile(fBlock , BlockedNicks , "BlockedNicks")
end
BlockTriggs = {
["$Rev"] = 1,
["$Con"] = 2,
}
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" then
local str1 = strsub(data,1,4)
if BlockTriggs[str1] then
if BlockedNicks[strlower(curUser.sName)] then
curUser:SendData("*** You are not authorized to download.")
return 1
else if BlockTriggs[str1] == 1 then
local _,_,conNick = strfind(data,"(%S+)|$")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user "..conNick.." you are trying to download from is not authorized to upload.")
return 1
end
else if BlockTriggs[str1] == 2 then
local _,_,conNick = strfind(strsub(data,14,strlen(data)),"^(%S+)")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user "..conNick.." you are trying to download from is not authorized to upload.")
return 1
end
end
end
end
end
end
-- if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.iProfile == 5 or curUser.iProfile == 0 then
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.bOperator then
data = strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind(data,"%b<>%s+(%S+)")
local _,_,nick = strfind(data,"%b<>%s+%S+%s+(%S+)")
if cmd and cmd == cmd2 and nick then
if BlockedNicks[strlower(nick)] then
BlockedNicks[strlower(nick)] = nil
SendPmToOps(OpChatName, nick.." is now unblocked.")
return 1
end
elseif cmd and cmd == cmd1 then
if BlockedNicks[strlower(nick)] == 1 then
curUser:SendPM(sBot, nick.." is already blocked. Use !unblock to unblock this user.")
return 1
else
BlockedNicks[strlower(nick)] = curUser.sName
SendPmToOps(OpChatName, nick.." is now blocked.")
return 1
end
if (uLaterPtokax == 1) then
OnExit()
end
return 1 -- TELLS THE HUB TO STOP PROCESSING THE DATA
elseif (cmd and cmd == cmd3 and curUser.bOperator) then
local sTmp,aux,nick = "Users Blocked in this HUB:\r\n\r\n"
for nick, aux in BlockedNicks do
sTmp = sTmp.."User:-->> "..nick.."\t Was Blocked by: "..aux.."\r\n"
end
--curUser:SendPM(sBot, sTmp)
SendPmToOps(OpChatName, sTmp)
return 1
end
end
end
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..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
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
Use this converter. http://board.univ-angers.fr/thread.php?threadid=3737&boardid=5&sid=990c17a9dc54f12de14fd39ebbc9099f&page=2 (http://board.univ-angers.fr/thread.php?threadid=3737&boardid=5&sid=990c17a9dc54f12de14fd39ebbc9099f&page=2)
Change DataArrival to ChatArrival.
Change the load and save functions to these:
function SaveToFile(file , table , tablename)
local handle = io.open(file,"w+")
handle:write(Serialize(table, tablename))
handle:flush()
handle:close()
end
function LoadFromFile(file)
local handle = io.open(file,"r")
if (handle ~= nil) then
loadstring(handle:read("*all"))
handle:flush()
handle:close()
end
end
(these are from http://board.univ-angers.fr/thread.php?threadid=3672&boardid=30&styleid=1&sid=990c17a9dc54f12de14fd39ebbc9099f (http://board.univ-angers.fr/thread.php?threadid=3672&boardid=30&styleid=1&sid=990c17a9dc54f12de14fd39ebbc9099f) )
hehehe ok sir, don the full conversion, but it still gives one error.
Syntax ...:\Robocop 10.1a\scripts\block_leechers-v3.0.lua5.lua:25: attempt to call method `EnableFullData' (a nil value)
QuoteOriginally posted by PPK
QuoteOriginally posted by jiten
attempt to call method `EnableFullData' (a nil value)
EnableFullData is removed in new PtokaX, is not more needed ;)
So i assume, just delete that line, and it might work. :)
thanks a lot sir i just removed that line and that script runs perfect now.
thanks a lot again sir.
hi ...... can some1 alter this script to work with the new hub build plz
as new build uses xml file's and not .dat
thx
eh??
I have 16.06 and it uses dat
Wheres new version??
QuoteOriginally posted by Jelf
eh??
I have 16.06 and it uses dat
Wheres new version??
16.07 was released but ppk found prob and closed link
but 16.08 is out on ptokax.org now
Hi,
something is strange with the regcleaner... If no-one is chatting, the message won't appear... but if someone says something, the message appears:
[00:07:24] The cleaner has been called. Every registered user who hasn't been in the hub for 10 weeks will be deleted. (contact the OP's if your gone be away for a period longer then that)
[00:07:24] 107 users were procest, 0 of them were deleted.
[00:07:24] <[SU]TTB> !mass
Someone else who has this weird thing?
i only get The cleaner has been called. Every registered user who hasn't been in the hub for 2 weeks will be deleted. (contact the OP's if your gone be away for a period longer then that)
sorry just read above :P :P
Anione can get this to work whit new reguser XML file in lates Ptokax
Greetzz TT
16.09 out now,new one every day :))
I need this one for the new 16.09 too... anyone can help?
There is this nice function (http://board.univ-angers.fr/thread.php?threadid=4082&boardid=4&page=1#1) if someone is interested .. ;)