Hi,
Block Uploads of a user, only OPs can download from him, can use the command !allow to add users to download from him.
Here you go...
--## Upload Blocker
--## Requested by charlie
--## Made by nErBoS
--## Commands (only for OPs):
--## !addblock -- Will block uploads from the user (only OPs can download from him)
--## !delblock -- Will remove the block from the user uploads
--## !allow -- Will allow the user "nick" to make downloads from the user "who"
--## !restrict -- Will remove the allow from the user "nick" to make downloads from the user "who"
--## !blocked -- Will show all user that are blocked and who is allowed to make downloads from him
sBot = "U-Blocker"
arrUser = {}
fUser = "user.dat"
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(fUser)
end
function OnExit()
SaveToFile(fUser , arrUser , "arrUser")
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!addblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !addblock , you must write a nick.")
elseif (type(arrUser[strlower(nick)]) == "table") then
user:SendPM(sBot, "The user "..nick.." is already blocked.")
else
arrUser[strlower(nick)] ={}
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been added a block. Now only OPs can download from him.")
user:SendPM(sBot, "If you want a user to download from him just use !allow.")
end
return 1
elseif (cmd == "!delblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !delblock , you must write a nick.")
elseif (arrUser[strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not blocked.")
else
arrUser[strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been removed the block. Now anyone can download from him.")
end
return 1
elseif (cmd == "!allow" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !allow , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] ~= nil) then
user:SendPM(sBot, "The user "..nick.." is already allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = user.sName
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." has been allowed to download from "..who)
end
return 1
elseif (cmd == "!restrict" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !restrict , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." is no more allowed to download from "..who)
end
return 1
elseif (cmd == "!blocked" and user.bOperator) then
local sTmp,usr,aux,usr2 = "The Users the have uploads blocked:"
for usr, aux in arrUser do
sTmp = sTmp.."\r\n\r\n--## Users that can download from "..usr..":\r\n\r\n"
for usr2, aux in arrUser[usr] do
sTmp = sTmp.."\t"..usr2.." Allowed by: "..aux.."\r\n"
end
end
user:SendPM(sBot, sTmp)
end
end
if (strsub(data,1,12) == "$ConnectToMe" and not user.bOperator) then
local s,e,from,toip = strfind(data, "$ConnectToMe%s+(%S+)%s+(%d+%.%d+%.%d+%.%d+):")
if (type(arrUser[strlower(from)]) == "table") then
if (CheckForPermission(arrUser[strlower(from)],toip) == 0) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
end
end
if (strsub(data,1,15) == "$RevConnectToMe" and not user.bOperator) then
local s,e,to,from = strfind(data, "$RevConnectToMe%s+(%S+)%s+(%S+)")
if (type(arrUser[strlower(from)]) == "table") then
if (arrUser[strlower(from)][strlower(to)] == nil) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
end
end
end
function CheckForPermission(table,ip)
local usr,aux
for usr, aux in table do
if (GetItemByName(usr) ~= nil and GetItemByName(usr).sIP == ip) then
return 1
end
end
return 0
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
Best regards, nErBoS
AWESOME WORK nErBoS !!!! (i had to try it 1st to believe...hihihi)
Really great sh****** :o)
This does look like a nifty little script, i would like to use it, but i think i will let my members be free hehehe. But thanx for sharing ur creation, maybe sometime i will use it, we will see. ;)
I am using DCPRO and am Master (0) in my hub. I put myself onto the blocklist and allowed ONE user to download from me but eberyone still can download from me!
Hi,
Is he getting this message...
"You can't download from Skyhawk. If you have any doubt talk with a OP."
???
If not the problem is not with the script.
Best regards, nErBoS
forgot to mention:
This hub is running PtokaX DC Hub 0.3.3.0 build 15.25 [debug]
Yes.
all users even the one i allowed to download from me got the message
i guess its a problem with the profiles.
My Nick has profile 0 (Master) and the user i allowed to download from me has profile 3 (reg)
My profile table:
0|Master|
1|Operator|
2|VIP|
3|Reg|
4|User|
5|Pop|
Hope this will help you tracking down the bug
here the message users got from the Bot:
[19:02] You can't download from [OP]www.••Skyhawk••.nl. If you have any doubt talk with a OP
Note: I have a space between Big AND Brother
try with put the space in the botname...
had severel problems in my script when adding a space in the botnick..
*** Typhoon?
Hi,
[OP]www.••Skyhawk••.nl
This is the nick that you have in your HUB ??
Best regards, nErBoS
When adding the name to the script.. do (alt+0160) for a space. That will take care of that problem.
-BH
QuoteOriginally posted by nErBoS
Hi,
[OP]www.••Skyhawk••.nl
This is the nick that you have in your HUB ??
Best regards, nErBoS
IMHO those crazy • are appearing because of the forum parser test > html .. Its some character in the MsSansSerif Font that dont exist in the font that the forum uses ..
Indeed Herodes i am using bullet dots in my nick
Well I changed the name of the bot from "Big Brother" into "Big-Brother"
But still every user can doownload from me.
Hi,
I belive that the problem could be from your nick, just try to register another nick (normal) has master and try out, (i have test it and worked ok)
Best regards, nErBoS
i never had any problems with my nick in other scripts
if it's really a problem mit those bullet signs could your script be addapted to include de codes for those signs?
by the way... th ASCII code for those bullets is
• = alt + 0149
can you alter the script to include this char ?
Hi,
I have tested with that char and worked fine, are you using the ptokax option like this... "uLaterPtokax = 0" ?? Give me the table that is in your user.dat.
Best regards, nErBoS
yes, this is the part in my script
--## Configuration ##--
uLaterPtokax = 0-- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0
--## END ##--
My Ptokax version:
[00:16:46] This hub is running PtokaX DC Hub 0.3.3.0 build 15.25 [debug] (UpTime: 0 days, 4 hours, 6 minutes)
My nick as registered in the file RegisteredUser.dat:
[OP]www.••Skyhawk••.nl|********|0
My table in user.dat:
arrUser = {
["[op]www.••skyhawk••.nl"] = {
["www.•••dj-chrissy•••.de"] = "[OP]www.••Skyhawk••.nl",
},
}
hope that will help
Note:the nicks in the table user lower-case only but the names as i registered it look like this:
//www.•••DJ-Chrissy•••.de
[OP]www.••Skyhawk••.nl
i guess you muss replace • with those bullets
Hi,
Better send the user.dat by mail becuase of board code, send to nerbos@sapo.pt
Best regards, nErBoS
did you get my mail ?
Hi,
I think i found the bug, delete your user.dat and let this new script start a new one...
--## Upload Blocker 1.0
--## Bug of case sensative (thanks Skyhawk for bug me :D )
--## Requested by charlie
--## Made by nErBoS
--## Commands (only for OPs):
--## !addblock -- Will block uploads from the user (only OPs can download from him)
--## !delblock -- Will remove the block from the user uploads
--## !allow -- Will allow the user "nick" to make downloads from the user "who"
--## !restrict -- Will remove the allow from the user "nick" to make downloads from the user "who"
--## !blocked -- Will show all user that are blocked and who is allowed to make downloads from him
sBot = "U-Blocker"
arrUser = {}
fUser = "user.dat"
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(fUser)
end
function OnExit()
SaveToFile(fUser , arrUser , "arrUser")
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!addblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !addblock , you must write a nick.")
elseif (type(arrUser[strlower(nick)]) == "table") then
user:SendPM(sBot, "The user "..nick.." is already blocked.")
else
arrUser[strlower(nick)] ={}
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been added a block. Now only OPs can download from him.")
user:SendPM(sBot, "If you want a user to download from him just use !allow.")
end
return 1
elseif (cmd == "!delblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !delblock , you must write a nick.")
elseif (arrUser[strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not blocked.")
else
arrUser[strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been removed the block. Now anyone can download from him.")
end
return 1
elseif (cmd == "!allow" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !allow , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] ~= nil) then
user:SendPM(sBot, "The user "..nick.." is already allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = strlower(user.sName)
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." has been allowed to download from "..who)
end
return 1
elseif (cmd == "!restrict" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !restrict , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." is no more allowed to download from "..who)
end
return 1
elseif (cmd == "!blocked" and user.bOperator) then
local sTmp,usr,aux,usr2 = "The Users the have uploads blocked:"
for usr, aux in arrUser do
sTmp = sTmp.."\r\n\r\n--## Users that can download from "..usr..":\r\n\r\n"
for usr2, aux in arrUser[usr] do
sTmp = sTmp.."\t"..usr2.." Allowed by: "..aux.."\r\n"
end
end
user:SendPM(sBot, sTmp)
end
end
if (strsub(data,1,12) == "$ConnectToMe" and not user.bOperator) then
local s,e,from,toip = strfind(data, "$ConnectToMe%s+(%S+)%s+(%d+%.%d+%.%d+%.%d+):")
if (type(arrUser[strlower(from)]) == "table") then
if (CheckForPermission(arrUser[strlower(from)],toip) == 0) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
end
end
if (strsub(data,1,15) == "$RevConnectToMe" and not user.bOperator) then
local s,e,to,from = strfind(data, "$RevConnectToMe%s+(%S+)%s+(%S+)")
if (type(arrUser[strlower(from)]) == "table") then
if (arrUser[strlower(from)][strlower(to)] == nil) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
end
end
end
function CheckForPermission(table,ip)
local usr,aux
for usr, aux in table do
if (GetItemByName(usr) ~= nil and GetItemByName(usr).sIP == ip) then
return 1
end
end
return 0
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
Best regards, nErBoS
I am sorry but the script isn't working.
1. replaced the script
2. deleted the user.dat
3. blocked me again
4. added NO users to allow
5. restartet the script so the new user.dat would be created
6. it was created
7. i closed the hubsoft
8. started it again
9. entered the hub as the first user
10. bang... one nick //www.***nick***.at started to download
Note: when i delete my block everyone can download
from me. with a block BUT without having ANYONE allowed to download from me, this nick from above could download (btw he has lowercase only and the user.dat STILL displays my nick in lovercase)
Hi,
Yes is ment to be in a lowercase. Is that user that can download from you a OP ??
Best regards, nErBoS
no he is a Reg User (profile 3)
master 0
operator 1
Vip 2
Reg 3
User 4
Pop 5
Hi,
Found the bug, try this one...
--## Upload Blocker 1.0
--## Big BUG Fixed (thanks Skyhawk for bugging me :D )
--## Requested by charlie
--## Made by nErBoS
--## Commands (only for OPs):
--## !addblock -- Will block uploads from the user (only OPs can download from him)
--## !delblock -- Will remove the block from the user uploads
--## !allow -- Will allow the user "nick" to make downloads from the user "who"
--## !restrict -- Will remove the allow from the user "nick" to make downloads from the user "who"
--## !blocked -- Will show all user that are blocked and who is allowed to make downloads from him
sBot = "U-Blocker"
arrUser = {}
arrRC = {}
fUser = "user.dat"
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(fUser)
end
function OnExit()
SaveToFile(fUser , arrUser , "arrUser")
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!addblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !addblock , you must write a nick.")
elseif (type(arrUser[strlower(nick)]) == "table") then
user:SendPM(sBot, "The user "..nick.." is already blocked.")
else
arrUser[strlower(nick)] = {}
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been added a block. Now only OPs can download from him.")
user:SendPM(sBot, "If you want a user to download from him just use !allow.")
end
return 1
elseif (cmd == "!delblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !delblock , you must write a nick.")
elseif (arrUser[strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not blocked.")
else
arrUser[strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been removed the block. Now anyone can download from him.")
end
return 1
elseif (cmd == "!allow" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !allow , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] ~= nil) then
user:SendPM(sBot, "The user "..nick.." is already allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = user.sName
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." has been allowed to download from "..who)
end
return 1
elseif (cmd == "!restrict" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !restrict , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." is no more allowed to download from "..who)
end
return 1
elseif (cmd == "!blocked" and user.bOperator) then
local sTmp,usr,aux,usr2 = "The Users the have uploads blocked:"
for usr, aux in arrUser do
sTmp = sTmp.."\r\n\r\n--## Users that can download from "..usr..":\r\n\r\n"
for usr2, aux in arrUser[usr] do
sTmp = sTmp.."\t"..usr2.." Allowed by: "..aux.."\r\n"
end
end
user:SendPM(sBot, sTmp)
end
end
if (strsub(data,1,12) == "$ConnectToMe") then
local s,e,to,ip = strfind(data, "$ConnectToMe%s+(%S+)%s+(%d+%.%d+%.%d+%.%d+):")
if (arrRC[to] == 1) then
arrRC[to] = nil
elseif (not user.bOperator and type(arrUser[strlower(to)]) == "table" and arrUser[strlower(to)][strlower(user.sName)] == nil) then
user:SendPM(sBot, "You can't download from "..to..". If you have any doubt talk with a OP.")
return 1
end
end
if (strsub(data,1,15) == "$RevConnectToMe") then
data = strsub(data,1,strlen(data)-1)
local s,e,from = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)")
if (not user.bOperator and type(arrUser[strlower(from)]) == "table" and arrUser[strlower(from)][strlower(user.sName)] == nil) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
arrRC[user.sName] = 1
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
Best regards, nErBoS
still no change :-(
i blocked myself and this one user can still download
could it be a software issue ?
i am using DC:Pro
Hi,
Very strange i made all types of tests and worked ok. Send to my mail in a text file that supports your bullet char your nick and the nick that is sttil downloading from you.
Best regards, nErBoS
Hi,
Skyhawk i have tested the BOT and didn't gave me any error. Tell me the address of your HUB and we will meet there to check out the problem.
Best regards, nErBoS
well i am not sure could it be a problem that i am using a beta version of ptokax?
This hub is running PtokaX DC Hub 0.3.3.0 build 15.25 [debug]
Hi,
No because i have tested the script in that version as also. Send me a PM with your HUB address to combine a date to appear in your HUB and have a check with you.
Best regards, nErBoS
OH OH OH
THIS SEEMS LIKE A MUST HAVE!!!!
GONA TRY IT!
I'm trying to use this script but i keep gettin this error
Syntax error: function arguments expected;
last token read: `=' at line 11 in file `C:\Axis_1_Ptokax\scripts\UBlocker.lua'
i was able to use this script before but i took it off and now that i want to put it back i get that error
code:----------------------------------------------------------------------------------## Upload Blocker
--## Requested by charlie
--## Made by nErBoS
--## Commands (only for OPs):
--## !addblock -- Will block uploads from the user (only OPs can download from him)
--## !delblock -- Will remove the block from the user uploads
--## !allow -- Will allow the user "nick" to make downloads from the user "who"
--## !restrict -- Will remove the allow from the user "nick" to make downloads from the user "who"
--## !blocked -- Will show all user that are blocked and who is allowed to make downloads from him
sBot = "?UBlocker?"
arrUser = {}
fUser = "user.dat"
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(fUser)
end
function OnExit()
SaveToFile(fUser , arrUser , "arrUser")
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!addblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !addblock , you must write a nick.")
elseif (type(arrUser[strlower(nick)]) == "table") then
user:SendPM(sBot, "The user "..nick.." is already blocked.")
else
arrUser[strlower(nick)] ={}
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been added a block. Now only OPs can download from him.")
user:SendPM(sBot, "If you want a user to download from him just use !allow.")
end
return 1
elseif (cmd == "!delblock" and user.bOperator) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
user:SendPM(sBot, "Syntax Error, !delblock , you must write a nick.")
elseif (arrUser[strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not blocked.")
else
arrUser[strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user has been removed the block. Now anyone can download from him.")
end
return 1
elseif (cmd == "!allow" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !allow , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] ~= nil) then
user:SendPM(sBot, "The user "..nick.." is already allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = user.sName
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." has been allowed to download from "..who)
end
return 1
elseif (cmd == "!restrict" and user.bOperator) then
local s,e,who,nick = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or who == nil) then
user:SendPM(sBot, "Syntax Error, !restrict , you must both nicks.")
elseif (arrUser[strlower(who)] == nil) then
user:SendPM(sBot, "The user "..who.." is not blocked.")
elseif (arrUser[strlower(who)][strlower(nick)] == nil) then
user:SendPM(sBot, "The user "..nick.." is not allow to download from "..who)
else
arrUser[strlower(who)][strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
user:SendPM(sBot, "The user "..nick.." is no more allowed to download from "..who)
end
return 1
elseif (cmd == "!blocked" and user.bOperator) then
local sTmp,usr,aux,usr2 = "The Users the have uploads blocked:"
for usr, aux in arrUser do
sTmp = sTmp.."\r\n\r\n--## Users that can download from "..usr..":\r\n\r\n"
for usr2, aux in arrUser[usr] do
sTmp = sTmp.."\t"..usr2.." Allowed by: "..aux.."\r\n"
end
end
user:SendPM(sBot, sTmp)
end
end
if (strsub(data,1,12) == "$ConnectToMe" and not user.bOperator) then
local s,e,from,toip = strfind(data, "$ConnectToMe%s+(%S+)%s+(%d+%.%d+%.%d+%.%d+):")
if (type(arrUser[strlower(from)]) == "table") then
if (CheckForPermission(arrUser[strlower(from)],toip) == 0) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
end
end
if (strsub(data,1,15) == "$RevConnectToMe" and not user.bOperator) then
local s,e,to,from = strfind(data, "$RevConnectToMe%s+(%S+)%s+(%S+)")
if (type(arrUser[strlower(from)]) == "table") then
if (arrUser[strlower(from)][strlower(to)] == nil) then
user:SendPM(sBot, "You can't download from "..from..". If you have any doubt talk with a OP.")
return 1
end
end
end
end
function CheckForPermission(table,ip)
local usr,aux
for usr, aux in table do
if (GetItemByName(usr) ~= nil and GetItemByName(usr).sIP == ip) then
return 1
end
end
return 0
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
Hi,
I have found a little bug, so i have edit the last script i have posted. About your erro skandaluz, maybe a bad copy from you the bot you have posted doesn't have any syntax error. Copy my again with careful.
Best regards, nErBoS