hi. can !regme
command be restricted for users with less than 15gb share?
Hi,
Well i see your point on that, you want only allow people to be reg if have more then 15 GB, but imagine that i put 15 GB in my share and reg myself, then after that i remove them, what happens then ??
Best regards, nErBoS
Completely agree with nErBoS as usual, but here you go.
Don't forget to run usercleaner by plop :P
-- note that everybody can unshare things!
minshare=15 -- in gigabytes
Bot="Reg-Bot"
function DataArrival (user,data)
if strsub(data,1,1)=="<" then
data=strsub(data,1,strlen(data)-1)
local _,_,cmd=strfind(data,"%b<>[%!%#%@%+](%S+)")
if cmd=="regme" then
regme(user)
return 1
end
end
end
function regme (user)
local _,_,temp = strfind(user.sMyInfoString, "$(%d+)%$")
local _,_,share = tonumber(temp)/1024/1024/1024
local _,_,pass=strfind(data,"%b<>%S+%s+(%S+)")
if pass then
if user.iProfile==-1 then
if share >= maxshare then
AddRegUser(user.sName,pass,3)
user:SendData(Bot,"You have registered yourself with the password "..pass)
else
user:SendData(Bot,"Too low share, it must be at least "..minshare)
end
else
user:SendData(Bot,"You are already registered")
end
else
user:SendData(Bot,"What if you specified that new password? You would not be happy if I generated one for you. >:-!")
end
end
thanks. that`s what i`ve been looking for. the thing is, once registered, the user can`t connect to the hub unless he shared more than 15 gb. so the script should work perfectly. i`ll try it out right now!
thanks
Hi i like idea of this script but instead of 15gb min share check, can it be done for nick prefix check i.e. if the user trying to register doesn't have prefix of [BBB] the bot wont register them and sendthem a message to prefix with [BBB] then come back and try again? This would save me and ops so much time obviously [BBB] needs to be able to be set to whatever hub owner wants. Many thanks for any help and sorry if this has been covered previously.
QuoteOriginally posted by catwo
Hi i like idea of this script but instead of 15gb min share check, can it be done for nick prefix check i.e. if the user trying to register doesn't have prefix of [BBB] the bot wont register them and sendthem a message to prefix with [BBB] then come back and try again? This would save me and ops so much time obviously [BBB] needs to be able to be set to whatever hub owner wants. Many thanks for any help and sorry if this has been covered previously.
I do not completely understand. You want it for 1 specific prefix, or user must not have a prefix @ all?
-- original by bastya_elvtars
-- note that everybody can unshare things!
-- added prefix by NightLitch
minshare =15 -- in gigabytes
uPrefix = "[BBB]"
Bot="Reg-Bot"
function DataArrival (user,data)
if strsub(data,1,1)=="<" then
data=strsub(data,1,strlen(data)-1)
local _,_,cmd=strfind(data,"%b<>[%!%#%@%+](%S+)")
if cmd=="regme" then
regme(user)
return 1
end
end
end
function regme (user)
local _,_,temp = strfind(user.sMyInfoString, "$(%d+)%$")
local _,_,prefix = strfind(user.sName, "^(%p%S+%p)%S+")
local share = tonumber(temp)/1024/1024/1024
local _,_,pass=strfind(data,"%b<>%S+%s+(%S+)")
if pass then
if user.iProfile == -1 then
if share >= minshare and prefix == uPrefix then
AddRegUser(user.sName,pass,3)
user:SendData(Bot,"You have registered yourself with the password "..pass)
else
user:SendData(Bot,"Too low share, it must be at least "..minshare.." and have Prefix "..uPrefix.." in your nickname")
end
else
user:SendData(Bot,"You are already registered")
end
else
user:SendData(Bot,"What if you specified that new password? You would not be happy if I generated one for you. >:-!")
end
end
Like that I guess...
you need the share and prefix.
if only prefix set share to 0
//NightLitch
A little remake from me, too little to do....
-- Advanced One By NightLitch
Bot="Reg-Bot"
Min = {
Share = 15,
Unit = "GB",
}
Prefix = {
["[BBB]"] = 1
["[Telia]"] = 1,
}
sUnit = {}
sUnit["KB"]= 1024
sUnit["MB"]= 1048576
sUnit["GB"]= 1073741824
sUnit["TB"]= 1099511627776
function DataArrival (sUser,sData)
if strsub(sData,1,1)=="<" then
sData=strsub(sData,1,strlen(sData)-1)
local _,_,Cmd = strfind(sData,"%b<>[%!%#%@%+](%S+)")
if Cmd=="regme" then
RegMe(sUser)
return 1
end
end
end
function RegMe(sUser,sData)
local _,_,curShare = strfind(sUser.sMyInfoString, "$(%d+)%$")
local _,_,curPrefix = strfind(sUser.sName, "^(%p%S+%p)%S+")
local _,_,Password =strfind(sData,"%b<>%S+%s+(%S+)")
if Password then
if sUser.iProfile == -1 then
if curShare >= Min.Share * sUnit[Min.Unit] and Prefix[curPrefix] then
AddRegUser(sUser.sName,Password,3)
sUser:SendData(Bot,"You have registered yourself with the password "..pass)
else
local list = "( "
for p,_ in Prefix do list = list .. p.." " end list = list .." )"
sUser:SendData(Bot,"Too low share, it must be at least "..Min.Share.." "..Min.Unit.." and have Prefix "..list.." in your nickname")
end
else
sUser:SendData(Bot,"You are already registered")
end
else
sUser:SendData(Bot,"What if you specified that new password? You would not be happy if I generated one for you.")
end
end
Cheers / NL
Many thanks it works a treat. Thanks for taking the time to help me, much appreciated.