Hi is the following possible?
1. User Types command !Regme in main chat.
2. Script kicks in and checks to see if the user is at or below the maximum allowed hubs e.g 10 and if so auto registers the user with their nick including a predifiend prefix [XXX] and also generates a password for them. (If the max hubs is to high then the script tells the user e.g. "Max hubs allowed here is 10, you are currently in 12 hubs, please reduce to 10 then retype !regme in main chat). However, if all is ok the script then tells the user to add the registration details to their settings and rejoin hub.
If this is possible? would someone please have a go at writing it for me. Your help would be most appreciated as my OPs and I are not always at our PCs and users get frustrated as I only allow registered users to search and download. Thanks in advance for any help or info.
-- By Dessamator
-- Simple Regme bot with hub checker
Prefix ="[XXX]"
bot = frmHub:GetHubBotName()
Maxhubs =10
function ChatArrival(user,data)
local pass=math.random(os.date("%H%M%S"))
data=string.sub(data,1,string.len(data)-1)
s,e,cmd =string.find(data, "%b<>%s+(%S+)")
if cmd=="!regme" then
if not(user.bRegistered) and not(frmHub:isNickRegged(Prefix..user.sName)) and user.iHubs AddRegUser(Prefix..user.sName, pass, 3)
user:SendData(bot,"Uve been registered with the Nick :"..Prefix..user.sName.." and password:"..pass)
elseif user.iHubs>Maxhubs then
user:SendData(bot,"Max hubs allowed here is "..Maxhubs..", you are currently in "..user.iHubs.." hubs, please reduce to "..Maxhubs.." then retype !regme in main chat")
else
user:SendData(bot,"You are Already Registered")
end
return 1
end
end
Done !,
Post Edited
Thanks again Dessamator for your prompt reply and your script work its much appreciated. It doesn't seem to work for my hub though, i'm using Ptokax 03.3.0 build 16.9 debug with Esthetic netserver V8-5. Any ideas please? Once again many thanks for your help.
hmm, any errors??, i tested it thoroughly it should work even in that version of the ptokax. i didnt use anything new !
No error messages just don't work. :(
well i tested it with ptokax 16.09, it didnt give me any errors, yaps found the prob, its with the xthetic server, it also has a regme command, the way to solve it, is to put "my" script above his, in the ptokax, move it up !!
Good Luck !
Yes! That solved it m8 many thanks for your help and assistance much appreciated. :D
ur welcome, :]
Dessamator any chance of an edit to the script so that if they already have the prefix [XXX] the script doesn't generate another one? At the moment i have some users with names like [XXX][XXX]Dessamator. Thanks in advance for any help.
hmm, it shouldnt happen unless the the user isnt regged, but ok ill change the script asap
Give this a try:
-- By Dessamator
-- Simple Regme bot with hub checker
-- Prefix checker by jiten
bot = frmHub:GetHubBotName()
Maxhubs = 10
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
local Prefix = "[XXX]" -- Set your prefix here
if cmd == "!regme" then
if string.find(string.lower(user.sName),string.lower(Prefix)) then Prefix = "" end
local pass=math.random(os.date("%H%M%S"))
if not(user.bRegistered) and not ( frmHub:isNickRegged(Prefix..user.sName) ) and user.iHubs < Maxhubs then
AddRegUser(Prefix..user.sName, pass, 3)
user:SendData(bot,"U've been registered with the Nick :"..Prefix..user.sName.." and password:"..pass)
elseif user.iHubs > Maxhubs then
user:SendData(bot,"Max hubs allowed here is "..Maxhubs..", you are currently in "..user.iHubs.." hubs, please reduce to "..Maxhubs.." then retype !regme in main chat")
else
user:SendData(bot,"You are Already Registered")
end
return 1
end
end
well done ! saves me the hassle, :)
Works a treat, thanks jiten & Dessamator for taking the time to help me and other non script writers out, its much appreciated. :D
ur welcome !
Anytime catwo... Btw, small update in the code...
Cheers
Hmmmm getting the odd one registering and in Ptokax Reg list not showing the [XXX] prefix, any ideas? Thanks in advance.
QuoteOriginally posted by catwo
Hmmmm getting the odd one registering and in Ptokax Reg list not showing the [XXX] prefix, any ideas? Thanks in advance.
hmm?, i didnt understand ur post, the "odd one registering "?????
Sorry m8 i'll try again. I get the odd user registering in hub but they dont have the [XXX] prefix. e.g. when i look in the registered users list i see catwo instead of [XXX]catwo and catwo is showing as (REG) in the user list.
QuoteOriginally posted by catwo
Sorry m8 i'll try again. I get the odd user registering in hub but they dont have the [XXX] prefix. e.g. when i look in the registered users list i see catwo instead of [XXX]catwo and catwo is showing as (REG) in the user list.
Testing it some minutes ago with both type of nicks and it's working well.
Btw, did that user reconnect with the new nick or just registered himself?
Cheers
They are showing in user list as {REG} without the prefix and when i look in Ptokax OPs/Bans registered users they are showing in the list without the [XXX] prefix?
hmm, i also tested it try copying the script again, the last one shouldnt have any bugs