This is a user self registration function for IceCube. I can't remember who wrote the share and the self reg parts but I merged them together. The only reason this bot has a share is because I hate seeing zeros in my hub cause it makes it look funny. The share is set to only 5 megs, and you can set it to zero if you feel it necessary. I would not advise using this with TD4 because A. The functions do not work and B. The user levels are different and regular users appear as Masters on the user profile list
__________________________________
botname = "Psideshow"
kb = 1024
mb = kb*kb
gb = kb*kb*kb
tb = kb*kb*kb*kb
pb = kb*kb*kb*kb*kb
bot_name = "Psideshow"
bot_email = "here@hub"
bot_speed = "Cable"
bot_descr = "PM me then type +regme"
bot_share_size = 5.67 * mb
function Main()
frmHub:RegBot( bot_name )
my_info_string = "$MyINFO $ALL "..bot_name.." "..bot_descr.."$ $"..bot_speed..strchar( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
end
function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end
function OpConnected(curUser)
curUser:SendData( my_info_string )
end
hubaddress="broken.no-ip.org"
-------------------------------------------------------------------------
--DO NOT EDIT BELOW THIS TEXT!
-------------------------------------------------------------------------
function Get1Arg(data)
s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
return arg
end
function Get2Arg(data)
s,e,cmd,arg,arg2 = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
return arg, arg2
end
function RegUser(user,data)
Get1Arg(data)
if arg==nil then
user:SendPM(botname, "You have to provide a password!")
end
if not arg==nil then
if not user.bOperator then
frmHub:AddRegUser(user.sName, arg, "0")
user:SendPM(botname, "You are now registered at "..frmHub:GetHubName().."!")
user:SendPM(botname, "Add this hub to your favourites (if you haven?t done so already),")
user:SendPM(botname, "and be sure to write down your account-information and password:")
user:SendPM(botname, "HubName:\t"..frmHub:GetHubName().." Address:\t"..hubaddress.."")
user:SendPM(botname, "Your Nick:\t"..user.sName.."")
user:SendPM(botname, "Your Password:\t"..arg.."")
end
if user.bOperator then
user:SendPM(botname, "Feel the need to deop yourself? ;)")
user:SendPM(botname, "If you want to register a useraccount use < +newuser Name Pwd >")
end
end
end
function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
if ( strsub(data, 1, 1) == "<" ) then
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if not cmd==nil then
if (cmd=="+regme") then
user:SendPM(botname,"It is not wise to display your password in the mainchat!")
user:SendPM(botname,"Send a pm to me and try again. ")
return 1
end
if (cmd=="+reg") or (cmd=="+reghelp") then
user:SendPM(botname,"Yes! It?s true! Now you can register an account with us!")
user:SendPM(botname,"To register:")
user:SendPM(botname,"Send a pm to "..botname.." and type < +regme ThePasswordYouWant >. Done!")
end
end
end
if ( strsub(data, 1, 5) == "$To: " ) then
s,e,whoTo,from=strfind(data, "$To:%s+(%S+)%s+From:%s+(%S+)")
if whoTo==botname then
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="+reg") or (cmd=="+reghelp") then
user:SendPM(botname,"Yes! It?s true! Now you can register an account with us!")
user:SendPM(botname,"To register:")
user:SendPM(botname,"Send a pm to "..botname.." and type < +regme ThePasswordYouWant >. Done!")
end
if (cmd=="+regme") then
RegUser(user,data)
end
if user.bOperator then
if (cmd=="+reguser") then
Get2Arg(data)
frmHub:AddRegUser(arg,arg2,"0")
user:SendPM(botname, "As you wish my master!")
user:SendPM(botname, "The user "..arg.." with the password "..arg2.." is now")
user:SendPM(botname, "registered at "..frmHub:GetHubName().." / "..hubaddress.."")
end
end
end
end
end
Can anyone make this run with TestDrive version?
and
I need to force the user to register the nick with an ISP like [reg] [vip] etc..
thanks
Bye
ok sorry i not much time have alot ahead with gekko 5 and loads of peeps are pestering me slowing me down, the more you pester me the longer i will be, so please dont come asking in my hub for help, my hub is sharing, not scripting this forum is for scripters and learning, btu anyways thats just to the peeps that do come meanwhle at the forum if i get time i come here so here we go
--sets the bot name for messages
Bot = "Viper"
--
function Main()
frmHub:RegBot(Bot)
end
function Get1Arg(data)
local s,e,whoTo,from,Cmd,arg = strfind(data,"$To:%s+("..Bot.."%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)")
return arg
end
function regHelp(user)
-- Read a complete file line for line and print them in the mainchat
readfrom("reghelp.txt")
while 1 do
local line = read()
if (line == nil) then
break
else
SendPmToNick(user.sName, Bot, line)
end
end
readfrom()
-- call readfrom() at the end to close the file
end
function DataArrival(user, data)
-- all users that are not OPs can do the following commands
if (user.bOperator) then
else
if( strsub(data, 1, 4) == "$To:" ) then
-- remove end pipe
data=strsub(data,1,strlen(data)-1)
-- parse the command
s,e,whoTo = strfind(data,"$To:%s+("..Bot.."%S+)")
if (whoTo == Bot) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+("..Bot.."%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="-reghelp" or cmd=="+reghelp" or cmd=="-help" or cmd=="+help") then
regHelp(user)
end
if (cmd=="-reg") then
arg = Get1Arg(data)
frmHub:AddRegUser(user.sName, arg, 0)
SendPmToNick(user.sName, Bot, "You have now added "..user.sName.." as a reguser, the password is:\" "..arg.."\" don't forget it...")
end
if (cmd=="-changepass") then
arg = Get1Arg(data)
frmHub:DelRegUser(user.sName)
frmHub:AddRegUser(user.sName, arg, 0)
SendPmToNick(user.sName, Bot, "You have now changed your password to:\" "..arg.."\" don't forget it...")
end
if (cmd=="-unregme") then
frmHub:DelRegUser(user.sName)
SendPmToNick(user.sName, Bot, "You have now deleted "..user.sName.." as a reguser")
end
end
end
end
-- all users can do the following commands
if ( strsub(data, 1, 1) == "<" ) then
-- remove end pipe
data=strsub(data,1,strlen(data)-1)
-- parse the command
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
if (cmd=="-reghelp" or cmd=="+reghelp") then
regHelp(user)
end
end
end
now im not toally sure if this is good, but maybe someone got the time to tweak it, goodluck
even has a new part of my bot in there the name ;)
he he he ive said to much byeeeeeeeeeeeeee
don't run, but if you can't help me, just say "no"...
Quoteuser:SendPM(botname,"Send a pm to "..botname.." and type < +regme ThePasswordYouWant >. Done!")
script editor return message:
Syntax Error: attempt to call field `AddRegUser' (a nil value)
QuoteOriginally posted by zliangb
Quoteuser:SendPM(botname,"Send a pm to "..botname.." and type < +regme ThePasswordYouWant >. Done!")
script editor return message:
Syntax Error: attempt to call field `AddRegUser' (a nil value)
this script is for icecube or earlyer, your running it on testdrive.
be happy that it doesn't work, users would become masters.
you need a different version of this script.
plop