Self Registration Script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Self Registration Script

Started by catwo, 15 May, 2005, 17:49:58

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

catwo

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.

Dessamator

#1
-- 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.iHubsMaxhubs 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
Ignorance is Bliss.

catwo

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.

Dessamator

#3
hmm, any errors??, i tested it thoroughly it should work even in that version of the ptokax. i didnt use anything new !
Ignorance is Bliss.

catwo

No error messages just don't work.  :(

Dessamator

#5
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 !
Ignorance is Bliss.

catwo

Yes! That solved it m8 many thanks for your help and assistance much appreciated. :D

Dessamator

ur welcome,  :]
Ignorance is Bliss.

catwo

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.

Dessamator

hmm, it shouldnt happen unless the the user isnt regged, but ok ill change the script asap
Ignorance is Bliss.

jiten

#10
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

Dessamator

well done ! saves me the hassle, :)
Ignorance is Bliss.

catwo

Works a treat, thanks jiten & Dessamator for taking the time to help me and other non script writers out, its much appreciated.  :D

Dessamator

Ignorance is Bliss.

jiten

Anytime catwo... Btw, small update in the code...

Cheers

catwo

Hmmmm getting the odd one registering and in Ptokax Reg list not showing the [XXX] prefix, any ideas? Thanks in advance.

Dessamator

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 "?????
Ignorance is Bliss.

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.

jiten

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

catwo

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?

Dessamator

hmm, i also tested it try copying the script again, the last one shouldnt have any bugs
Ignorance is Bliss.

SMF spam blocked by CleanTalk