!regme restriction
 

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

!regme restriction

Started by lawler, 15 November, 2004, 23:50:42

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lawler

hi. can !regme command be restricted for users with less than 15gb share?


nErBoS

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
--## nErBoS Spot ##--

bastya_elvtars

#2
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
Everything could have been anything else and it would have just as much meaning.

lawler

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

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.

bastya_elvtars

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?
Everything could have been anything else and it would have just as much meaning.

NightLitch

#6
-- 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
//NL

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
//NL

catwo

Many thanks it works a treat.  Thanks for taking the time to help me, much appreciated.

SMF spam blocked by CleanTalk