Nonstandard account checker bot
 

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

Nonstandard account checker bot

Started by Requiem, 19 December, 2004, 03:25:18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Requiem

Hi

I am using PtokaX DC Hub 0.3.2.6 TestDrive 4.99 with RoboCop v9.0e. I set min share limit for Regged to 20 Gb and for Users to 0 Gb. I use RoboCop's download blocker to force users share more and reg themselves to download. But in my network, I have to keep people with small sharings, even 1 GB sharers.. So I created some extra LowShare [LSx] accounts for them. These are the rules:

[LS1] >> min 1 GB up to 5 GB
[LS2] >> min 5 GB up to 10 GB
[LS3] >> min 10 GB up to 20 GB

Rules are working pretty fine. Everybody is happy but I am not. Cos I can't control their min and max share with a bot. Can somebody help me?

PtokaX profiles:
0|Master|11111110111111111111000000000000
1|Operator|11110100001001111111000000000000
2|VIP|10000000000001111000000000000000
3|Reg|10000000000000000000000000000000
4|Moderator|11111110011101111111000000000000
5|NetFounder|11111111111111111111000000000000
6|LS1|10000000000000000000000000000000
7|LS2|10000000000000000000000000000000
8|LS3|10000000000000000000000000000000


bastya_elvtars

Hi, here you go:

-- share check by profiles
-- by bastya_elvtars
-- for Requiem
-- feel free to include any profile index (not name!) - see profiles.dat


profiles_share={ -- [profileindex]=minshareingigabytes

[6]=10,

[7]=20,

[8]=30,

}

maxShare=2 -- in terabytes, to keep out some idiot fakeeeeeeeeeeeeers

todoforlowshare=1 -- 1 to disconnect, 2 to redirect

redir_addy="redirect.address.here"

-- do not edit below

function NewUserConnected(user)
	checkshare(user)
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" then
		checkshare(user)
	end
end

checkshare=function(user)
	local _,_,temp = strfind(user.sMyInfoString, "%$(%d+)%$")
	local minshare=minShare*1024*1024*1024
	local maxshare=maxShare*1024*1024*1024*1024
	local Share = format("%0.2f", tonumber(temp)/gb)
	if tonumber(temp) < minshare then
		if todoforlowshare == 2 then
			user:SendData("ShareCheck","You do not meet the share minimum ("..minShare.." GB)!")
			user:SendData("RedirectBot","You are being redirected ... ")
			user:SendData("$ForceMove "..redir_addy.."|")
		elseif todoforlowshare==1 then
			user:SendData("ShareCheck","You do not meet the share minimum, and are being disconnected ...")
			user:Disconnect()
		end
	elseif tonumber(temp) > maxshare then
		user:SendData("ShareCheck","Do you really think that i believe that you are sharing "..format("%0.2f", tonumber(temp)/(gb*1024)).." TBytes of data??? |")
		user:Disconnect() return "shit"
	end
end
Everything could have been anything else and it would have just as much meaning.

Requiem

#2
Thank you bastya_elvtars, as far as I see it works fine. May I request a script that can be used to register LSx accounts with commands just like !regreg or !regvip ? (I need !regls1 !regls2 !regl3 for sure)

This is all I need now cos I have to do all these from server soft and there are many LSx accounts.

Best regards.

bastya_elvtars

QuoteOriginally posted by Requiem
Thank you bastya_elvtars, as far as I see it works fine. May I request a script that can be used to register LSx accounts with commands just like !regreg or !regvip ? (I need !regls1 !regls2 !regl3 for sure)

This is all I need now cos I have to do all these from server soft and there are many LSx accounts.

Best regards.

sure, m8, but a bit later in the evening. You will be amazed! ;)
Everything could have been anything else and it would have just as much meaning.

Requiem

Hi.

I need this script urgently (there are about 150-200 people waiting to be regged as LowShare and I am alone :( ). Can somebody else help me?

bastya_elvtars

#5
Not tested. Please feedback!

-- share check & reg by profiles
-- by bastya_elvtars
-- for Requiem
-- use !command  
-- feel free to include any profile index (not name!) - see profiles.dat


levels_height={ -- profile_index=strength_of_level
			-- determines the power of levels. why? see below
			-- you can also exclude ppl you dont want to be able to allow to reg
--master:

[0]=4, 

-- op: 

[1]=3,

-- moderator:

[4]=5,

-- netfounder:

[5]=6,

}

allowed_to_reg=3 -- minimum profile power (see above) for the ppl alowed to reg these folks - if you set Ops as 2, VIPs as 1,
				-- and this value is 2, Ops can reg ppl, vips cannot.

profiles_share={ -- [profileindex]=minshareingigabytes

[6]=10,

[7]=20,

[8]=30,

}

profiles_cmd={ -- ["command"]=profile_index,

["!regls1"]=6,

["!regls2"]=7,

["regls3"]=8,
}



maxShare=2 -- in terabytes, to keep out some idiot fakeeeeeeeeeeeeers

todoforlowshare=1 -- 1 to disconnect, 2 to redirect

redir_addy="redirect.address.here"

-- do not edit below

profiles={}

function NewUserConnected(user)
	checkshare(user)
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" then
		if user.sMyInfoString and strlen (user.sMyInfoString) > (strlen(user.sName)+13) then
			checkshare(user)
		end
	elseif strsub(data,1,1)=="<" then
		data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"%b<>%s+[%!%+%#](%S+)")
		if cmd then
			if profiles_cmd[cmd] then
				regprof(user,data,profiles_cmd[cmd])
				return 1
			end
		end
	end
end

checkshare=function(user)
	if profiles_share[user.iProfile] then
		local _,_,temp = strfind(user.sMyInfoString, "%$(%d+)%$")
		if not temp then user:SendData("ShareCheck","Your client is idiot."); user:Disconnect() return 1 end
		local minshare=profiles_share[user.iProfile]*1024*1024*1024
		local maxshare=maxShare*1024*1024*1024*1024
		if tonumber(temp) < minshare then
			if todoforlowshare == 2 then
				user:SendData("ShareCheck","You do not meet the share minimum ("..minShare.." GB)!")
				user:SendData("RedirectBot","You are being redirected ... ")
				user:SendData("$ForceMove "..redir_addy.."|")
			elseif todoforlowshare==1 then
				user:SendData("ShareCheck","You do not meet the share minimum, and are being disconnected ...")
				user:Disconnect()
			end
		elseif tonumber(temp) > maxshare then
			user:SendData("ShareCheck","Do you really think that i believe that you are sharing "..format("%0.2f", tonumber(temp)/(gb*1024)).." TBytes of data??? |")
			user:Disconnect() return "shit"
		end
	end
end

function loadusers()
	local regusers={}
	readfrom("../RegisteredUsers.dat")
	while 1 do
		local line = read()
		if line == nil then 
				readfrom()
				break 
		end
		local _,_,name,levl = strfind(line,"(.+)|.+|(%d+)")
		regusers[name]=tonumber(levl)
		
	end
	readfrom()
	return regusers
end


function regprof(user,data,idx)
	if levels_height[user.iProfile] and levels_height[user.iProfile]>=allowed_to_reg then
		local regppl=loadusers()
		local _,_,cmd,toreg,pw=strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)")
		if toreg and pw then
			if regppl[toreg] then
				user:SendData("Reggabot","User is already regged as "..GetProfileName(regppl[toreg]).." !!! Do not waste my time!")
			else
				AddRegUser(toreg,pw,idx)
				SendToNick(toreg," "..user.sName.." has regged you as "..GetProfileName(idx).." with password "..pw" . Edit your settings in Favourite Hubs and reconnect!")
				SendToOps(" "..user.sName.." has regged "..toreg.." as "..GetProfileName(idx)".")
			end
		else
			user:SendData("Reggabot","Bad usage! Correct usage: "..cmd.."  ")
		end
	else
		user:SendData("Reggabot","Not allowed to reg!")
	end
end
Everything could have been anything else and it would have just as much meaning.

Requiem

I get:

Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: attempt to perform arithmetic on global `minShare' (a nil value)
Syntax Error: attempt to perform arithmetic on global `minShare' (a nil value)
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: attempt to perform arithmetic on global `minShare' (a nil value)
Syntax Error: attempt to perform arithmetic on global `minShare' (a nil value)


And also; commands don't work.

Requiem

I also noticed that I need some extra codes to check these extra profiles' slots. RoboCop neither PtokaX doesn't do that (PtokaX applies a global slot check but min slot value varies as to profiles in my hub)

bastya_elvtars

edited the script

slot check would be quite hard, maybe this is rather a robo update

also make sure you run this script after robo ie it is after the robo lua in alphab order
Everything could have been anything else and it would have just as much meaning.

Requiem

Thank you. I will change this scripts name to ZZZ.lua and try but I must ask: May I translate and edit the script in my native language just as:

-- share check & reg by profiles
-- by bastya_elvtars
-- for Requiem
-- use !command  
-- feel free to include any profile index (not name!) - see profiles.dat


levels_height={ -- profile_index=strength_of_level
			-- determines the power of levels. why? see below
			-- you can also exclude ppl you dont want to be able to allow to reg
--master:

[0]=4, 

-- op: 

[1]=3,

-- moderator:

[4]=5,

-- netfounder:

[5]=6,

}

allowed_to_reg=3 -- minimum profile power (see above) for the ppl alowed to reg these folks - if you set Ops as 2, VIPs as 1,
				-- and this value is 2, Ops can reg ppl, vips cannot.

profiles_share={ -- [profileindex]=minshareingigabytes

--VIP icin
[2]=80,

--REG icin
[3]=20,

--LS1 icin
[6]=1,

--LS2 icin
[7]=5,

--LS3 icin
[8]=10,

}

profiles_cmd={ -- ["command"]=profile_index,

["!regls1"]=6,

["!regls2"]=7,

--I found out that here is ! missing, I added it. Is it wrong?

["!regls3"]=8,
}



maxShare=1 -- in terabytes, to keep out some idiot fakeeeeeeeeeeeeers

todoforlowshare=1 -- 1 to disconnect, 2 to redirect

redir_addy="127.0.0.1"

-- do not edit below

profiles={}

function NewUserConnected(user)
	checkshare(user)
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" then
		if user.sMyInfoString and strlen (user.sMyInfoString) > (strlen(user.sName)+13) then
			checkshare(user)
		end
	elseif strsub(data,1,1)=="<" then
		data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"%b<>%s+[%!%+%#](%S+)")
		if cmd then
			if profiles_cmd[cmd] then
				regprof(data,profiles_cmd[cmd])
				return 1
			end
		end
	end
end

checkshare=function(user)
	local _,_,temp = strfind(user.sMyInfoString, "%$(%d+)%$")
	local minshare=profiles_share[user.iProfile]*1024*1024*1024
	local maxshare=maxShare*1024*1024*1024*1024
	local Share = format("%0.2f", tonumber(temp)/gb)
	if tonumber(temp) < minshare then
		if todoforlowshare == 2 then
			user:SendData("ShareCheck","Profiliniz i?in ?ng?r?len en az paylasim miktarini ("..minShare.." GB) karsilayamiyorsunuz.!")
			user:SendData("RedirectBot","Yonlendirildiginiz adres: ")
			user:SendData("$ForceMove "..redir_addy.."|")
		elseif todoforlowshare==1 then
			user:SendData("ShareCheck","Profiliniz i?in ?ng?r?len en az paylasim miktarini karsilayamiyorsunuz. Hub'la baglantiniz kesilecektir..")
			user:Disconnect()
		end
	elseif tonumber(temp) > maxshare then
		user:SendData("ShareCheck","Sence ger?ekten "..format("%0.2f", tonumber(temp)/(gb*1024)).." TByte paylastigina inaniyor muyum??? |")
		user:Disconnect() return "shit"
	end
end

function Main()
	loadprofiles()
end


function loadprofiles()
	readfrom("../Profiles.dat")
	while 1 do
		local line = read()
		if line == nil then 
				readfrom()
				break 
		end
		local _,_,idx,name = strfind(line,"(.+)|(.+)|%d+")
		profiles[tonumber(idx)]=name
	end
	readfrom()
end

function loadusers()
	local regusers={}
	readfrom("../RegisteredUsers.dat")
	while 1 do
		local line = read()
		if line == nil then 
				readfrom()
				break 
		end
		local _,_,name,levl = strfind(line,"(.+)|.+|(%d+)")
		regusers[name]=tonumber(levl)
		
	end
	readfrom()
	return regusers
end


function regprof(user,data,idx)
	if levels_height[user.iProfile] and levels_height[user.iProfile]>=allowed_to_reg then
		local regppl=loadusers()
		local _,_,cmd,toreg,pw=strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)")
		if toreg and pw then
			if regppl[toreg] then
				user:SendData("Vadi-Guvenlik","Kullanici zaten "..GetProfileName(regppl[toreg]) olarak kaydedilmistir..." !!! Birbirimizi kandirmayalim...!")
			else
				AddRegUser(toreg,pw,idx)
				SendToNick(toreg," "..user.sName.." tarafindan "..GetProfileName(idx).." olarak "..pw" sifresiyle kaydedildiniz. Lutfen Favorite Hubs'tan ayarlarinizi d?zeltip yeniden baglaniniz!")
				SendToOps(" "..user.sName.." , "..toreg.." 'i "..GetProfileName(idx)" olarak kaydetmistir...")
			end
		else
			user:SendData("Vadi-Guvenlik","Komut dizilimi hatali! Su sekilde kullanmalisiniz: "..cmd.."  ")
		end
	else
		user:SendData("Vadi-Guvenlik","Kullanici kayit etmek i?in yeterli yetkiniz yoktur. Uzgunum.")
	end
end

Requiem

I have found that translating sux  :]  so decided to use the original script and got errors while trying to reg a LS3

No syntax errors in script file PtokaX\scripts\RoboCop.lua
No syntax errors in script file PtokaX\scripts\ZLSxBot.lua

Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: attempt to perform arithmetic on a nil value
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: attempt to perform arithmetic on a nil value
Syntax Error: attempt to index local `user' (a string value)

bastya_elvtars

wahaaaaaaaaa im an idiot... updated again

sorry gotta go sleep test till then if erroneous maby somebody will fix

sorry i am really sleeeeeeeeeeeeeeepy now
Everything could have been anything else and it would have just as much meaning.

Requiem

thank you for everything you have done. have a good sleep.

bastya_elvtars

ok woke up.

any errors?

:D
Everything could have been anything else and it would have just as much meaning.

Requiem

Lots of errors like:

Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: attempt to perform arithmetic on a nil value
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: table index is nil
Syntax Error: attempt to perform arithmetic on a nil value

bastya_elvtars

when do they occur?
Everything could have been anything else and it would have just as much meaning.

Requiem

whenever the script loads, I try to reg a profile, script sees a new user etc. Nearly whatever i do..

bastya_elvtars

ok probably fixed

altho tested on 15.25

edited the above
Everything could have been anything else and it would have just as much meaning.

Requiem

Tested and still getting "Syntax Error: table index is nil" errors upon loading script and trying to use a !regls command. Would you like my whole hub soft to try it yourself?

bastya_elvtars

updated again

nothing happens on script restart: so debugging is easier and also optimized.
Everything could have been anything else and it would have just as much meaning.

Requiem

Getting Syntax Error: table index is nil when trying to reg smo.

bastya_elvtars

QuoteOriginally posted by Requiem
Getting Syntax Error: table index is nil when trying to reg smo.

gonna look in the evening
Everything could have been anything else and it would have just as much meaning.

kepp

To start with you're passing two variables
regprof(data,profiles_cmd[cmd])

function regprof(user,data,idx) <-- holds 3

so, user in regprof is the data you pass in DataArr
Also some checks wether.

Another thing to think of is the hash, etc:
Table = {[0] = 1,[1] = 4,[2] = 1}
PrintTable(4)

function PrintTable(Idx)
   print(Table[Idx]);
end

Can you notice the problem in this one?
Guarding    

Requiem

Kepp, can you tell me how to and where to use these codes? Will I add them to bastya_elvtars' script?

kepp

i gave bast a hint, thats all
Guarding    

SMF spam blocked by CleanTalk