ok guy's i tryed to confert this script but i ended up with a total fucked up script.
plz help me out with this script.
--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
Try this one:
--100% Blocker by chill
-- converted to LUA 5 by jiten
--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)
LoadFromFile(fBlock)
end
function OnExit()
SaveToFile(fBlock , BlockedNicks , "BlockedNicks")
end
BlockTriggs = {
["$Rev"] = 1,
["$Con"] = 2,
}
function ChatArrival(curUser,data)
if string.sub(data,1,1) == "$" then
local str1 = string.sub(data,1,4)
if BlockTriggs[str1] then
if BlockedNicks[string.lower(curUser.sName)] then
curUser:SendData("*** You are not authorized to download.")
return 1
else if BlockTriggs[str1] == 1 then
local _,_,conNick = string.find(data,"(%S+)|$")
if BlockedNicks[string.lower(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 = string.find(string.sub(data,14,string.len(data)),"^(%S+)")
if BlockedNicks[string.lower(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 (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) and curUser.iProfile == 5 or curUser.iProfile == 0 then
if string.sub(data,1,1) == "<" and curUser.bOperator then
data = string.sub(data,1,string.len(data)-1)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
local _,_,nick = string.find(data,"%b<>%s+%S+%s+(%S+)")
if cmd and cmd == cmd2 and nick then
if BlockedNicks[string.lower(nick)] then
BlockedNicks[string.lower(nick)] = nil
SendPmToOps(OpChatName, nick.." is now unblocked.")
return 1
end
elseif cmd and cmd == cmd1 then
if BlockedNicks[string.lower(nick)] == 1 then
curUser:SendPM(sBot, nick.." is already blocked. Use !unblock to unblock this user.")
return 1
else
BlockedNicks[string.lower(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 ToArrival(curUser,data)
if string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot and curUser.bOperator then
data = string.sub(data,1,string.len(data)-1)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
local _,_,nick = string.find(data,"%b<>%s+%S+%s+(%S+)")
if cmd and cmd == cmd2 and nick then
if BlockedNicks[string.lower(nick)] then
BlockedNicks[string.lower(nick)] = nil
SendPmToOps(OpChatName, nick.." is now unblocked.")
return 1
end
elseif cmd and cmd == cmd1 then
if BlockedNicks[string.lower(nick)] == 1 then
curUser:SendPM(sBot, nick.." is already blocked. Use !unblock to unblock this user.")
return 1
else
BlockedNicks[string.lower(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 string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and string.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)
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
dofile(file)
handle:flush()
handle:close()
end
end
Best regards.
thanks man, dunno what i did wrong but it works.
but there is just one lil prob.
it's only been written to the file after i blokked one and did a restartscript's.
and it seems too that the one who is set as blocked is not blocked at all.
i have the same problem and i already had it done so far but dunno how to fix it :S it doesnt block and it doesnt report it in the .dat file only when i restart script and then it isnt in the !laatzien command ;(
Greetz Metallic
I'm gonna have a look at it later...
Meanwhile, check these related scripts Here (http://board.univ-angers.fr/thread.php?threadid=3830&boardid=26&styleid=1&sid=bf04a84710a2be8cbba29e68b2952203), here (http://board.univ-angers.fr/thread.php?threadid=3673&boardid=28&sid=bf04a84710a2be8cbba29e68b2952203), and here (http://board.univ-angers.fr/thread.php?threadid=3674&boardid=26&sid=bf04a84710a2be8cbba29e68b2952203).
Best regards.
hehehe, ok sir seen them all now but these files are not what we had in mind, this bot works differend from the others.
have looked at the scripts but those scripts are already in robocop 10.01b so dont need them thanks anyway.
Greetz Metallic
Well, conversion complete.
Check this thread (http://board.univ-angers.fr/thread.php?threadid=4034&boardid=26&styleid=1&sid=28e7f17bfec24a7d437bc57e0d3a3a2d&page=1#1) .
Cheers
Wheeeee man thanks now it work perfect again
anytime :]