Help whit prefix 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

Help whit prefix script

Started by Robban, 18 September, 2004, 11:18:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Robban

This script only let user to connect if they got [Prefix] in thier nick. But It got one little problem that I hope someone can correct for me.

I only want users whit nick [Prefix]Nickname to join. But now users whit nickname like Nickname[Prefix] can join.

I notice one more thing now... I want the Prefix that I added always should be at the first. I got a new user in my hub whit name [BBB][10Mbit]Nickname but I want the script to tell him thats wrong nickname and he most use [10Mbit] first.

-- Made by dEFiNE
BotName = "-Bot-" 
ISP = {"[100Mbit]","[10Mbit]","[8Mbit]","[5Mbit]","[2.5Mbit]","[2Mbit]","[1Mbit]","[0.8Mbit]","[0.5Mbit]","[0.4Mbit]","[0.2Mbit]","[0.1Mbit]"} 

-- Main Sub 
function Main() 
frmHub:RegBot(BotName) 
end 


function NewUserConnected(curUser) 

for key, value in ISP do --Loop ISP Array 
if (strfind(strlower(curUser.sName), strlower(value),1,1)) then  
x=1 
break 
else 
x=0 
end 
end 

if (x == 0) then 
-- Kick user 
curUser:SendPM(BotName, "") 
curUser:SendPM(BotName, "Your nick should includ one of this [100Mbit] or [10Mbit] or [8Mbit] or [5Mbit] or [2.5Mbit] or [2Mbit] or [1Mbit] or [0.8Mbit] or [0.5Mbit] or [0.4Mbit] or [0.2Mbit] or [0.1Mbit]") 
curUser:SendPM(BotName, "Change your nick so it display your upload speed. Like this [0.8Mbit]Nickname, Then you are welcome back!") 
curUser:SendPM(BotName, "Not working? Look here - [URL]http://www.hompage.com[/URL] -") 
curUser:Disconnect() 
end 

end

UwV

\NL   The knowledge and skills you have achieved are meant to be forgotten so you can float comfortably in emptiness, without obstruction.
" Holly loves me,...  . "      ;o)

& don't forget, the motto is :
  -- SUPPORT YOUR LOCAL DJ'S --

nErBoS

Hi,

Try out this...

-- Made by dEFiNE
-- Mod by nErBoS asked by Robban

BotName = "-Bot-" 

ISP = { 
	"[100Mbit]",
	"[10Mbit]",
	"[8Mbit]",
	"[5Mbit]",
	"[2.5Mbit]",
	"[2Mbit]",
	"[1Mbit]",
	"[0.8Mbit]",
	"[0.5Mbit]",
	"[0.4Mbit]",
	"[0.2Mbit]",
	"[0.1Mbit]"
} 

function Main() 
	frmHub:RegBot(BotName) 
end 


function NewUserConnected(curUser) 
	if (ValidateNick(curUser) == 0) then
		curUser:SendData(BotName, "Your nick should includ one of this [100Mbit] or [10Mbit] or [8Mbit] or [5Mbit] or [2.5Mbit] or [2Mbit] or [1Mbit] or [0.8Mbit] or [0.5Mbit] or [0.4Mbit] or [0.2Mbit] or [0.1Mbit]") 
		curUser:SendData(BotName, "Change your nick so it display your upload speed. Like this [0.8Mbit]Nickname, Then you are welcome back!") 
		curUser:SendData(BotName, "Not working? Look here - [URL]http://www.hompage.com[/URL] -") 
		curUser:Disconnect()
	end 
end

function ValidateNick(curUser)
	if (strfind(curUser.sName, "%b[]%b[]%S+")) then
		curUser:SendData(BotName, "You can't have two prefixes.")
		return 0
	else
		for key, value in ISP do
			if (strlen(curUser.sName) >= strlen(value) and strsub(strlower(curUser.sName),1,strlen(value)) == strlower(value)) then  
				return 1
			end 
		end 
	end
	return 0
end

Best regards, nErBoS
--## nErBoS Spot ##--

bastya_elvtars

this can do the job either...

-- NickLaw by bastya_elvtars (the rock n' roll doctor)
-- thx to Mutor for AllowNicks 1.0
-- ripped from LawMaker

---------- CONFIG PART

-- the next option defines who GET prefix checked, if checknick is set to 1.
cnlevel=3               -- 5:all users
                                -- 4 ops & below
                                -- 3 vips & below
                                -- 2 registered users & below
                                -- 1 guests only

--  what prefixes can be used?
-- format: [PREFIX] or (PREFIX) or {PREFIX}
-- note that check is case sensitive, so [hun] is not equal to [HUN]
-- don't forget the comma! "(blahblah)",

pref ={
"[HUN]",
"[EU]",
"(HUN)",
}

----------END OF CONFIG PART

function DataArrival(user,data)
	if strsub(data, 1, 13) == "$ValidateNick" then
		local sdata=strsub(data,1,strlen(data)-1)
		local _,_,nm=strfind(sdata,"$ValidateNick%s+(%S+)")
		determineprefix(nm)
	end
end

function NewUserConnected(user)
	if CheckUserLevel(user) <= cnlevel then
		if checkprefix(user)=="shit" then return 1 end
	end
end

function determineprefix(data)
	_,_,prefix = strfind(data, "^([%[%{%(]%S+[%)%}%]])")
end


function checkprefix(user)
local p=function()
	local mess="\r\n====================\r\n"
	sort(pref)
	for b=1,getn(pref)do
		mess=mess..pref[b].."\r\n"
	end
	mess=mess.."====================\r\n\r\nNote that the check is case sensitive, a.k.a. [prefix] and [PREFIX] are different."
	return mess
	end
-- checks the prefix
	if not prefix then
		user:SendData("NickNameCheck", "\r\nNo prefix specified, use one of these:"..p())
		user:Disconnect() return "shit"
	end
end

function CheckUserLevel(user)
	if user.iProfile==0 then
		return 5
	elseif user.iProfile==1 then
		return 4
	elseif user.iProfile==3 then
		return 2
	elseif user.iProfile==2 then
		return 3
	else 
		return 1
	end
end
Everything could have been anything else and it would have just as much meaning.

Robban

Thx for all repaly :)

I got another reqest for this script... If some wants to help to add slotrule for every prefix...

Like if someone have prefix [0.5Mbit] He is only allowed to have 3slots open... And if someone has prefix [10Mbit] he is only allowed to have 9slot open. If they break this they will be kicked. Only kicked not time ban or nothing. They should recoonect again it they have correct the problem.

Like this...

   [100Mbit] = 9slots
   [10Mbit] = 9slots
   [8Mbit] = 9slots
   [5Mbit] = 7slots
   [2.5Mbit] = 5slots
   [2Mbit] = 5slots
   [1Mbit] = 4slots
   [0.8Mbit] = 3slots
   [0.5Mbit] = 3slots
   [0.4Mbit] = 2slots
   [0.2Mbit] = 1slots
   [0.1Mbit] = 1slots

nErBoS

Hi,

Yes it can be made but a user can put in his tag [0.1Mbit] connection just to have 1 slot open and in the realaty he could have a [10Mbit] connection. Do you still want that mod ???

Best regards, nErBoS
--## nErBoS Spot ##--

Robban

#6
Yes I still want it... It does not do anything if he has 1 slot open. If he has 1 slot open if will be hard to get slot from him but then someone get slot they will have full speed. The rules in my hub are

At least 1 slot hub, and max 3 hubs (Swedish hub = Fast connection = Low slotrules)

Hope you understand :)

This should only be whit regual users not VIP or above

And one more thing.. Your script didn't work any good. It will not leet VIP users loggin whit [VIP] in prefix. bastya_elvtars worked for a while but stopped working so I changde to Mutors script and it works really good.

nErBoS

Hi,

Try this then...

-- Made by dEFiNE
-- Mod by nErBoS asked by Robban

BotName = "-Bot-" 

ISP = { 
	["[100Mbit]"] = 9,
	["[10Mbit]"] = 9,
	["[8Mbit]"] = 9,
	["[5Mbit]"] = 7,
	["[2.5Mbit]"] = 5,
	["[2Mbit]"] = 5,
	["[1Mbit]"] = 4,
	["[0.8Mbit]"] = 3,
	["[0.5Mbit]"] = 3,
	["[0.4Mbit]"] = 2,
	["[0.2Mbit]"] = 1,
	["[0.1Mbit]"] = 1,
} 

function Main() 
	frmHub:RegBot(BotName) 
end 


function NewUserConnected(curUser) 
	if (curUser.iProfile ~= 2) then
		local val,slot = ValidateNick(curUser)
		local s,e,slots = strfind(curUser.sMyInfoString, "S:(%d+)")
		if (val == 0) then
			curUser:SendData(BotName, "Your nick should includ one of this [100Mbit] or [10Mbit] or [8Mbit] or [5Mbit] or [2.5Mbit] or [2Mbit] or [1Mbit] or [0.8Mbit] or [0.5Mbit] or [0.4Mbit] or [0.2Mbit] or [0.1Mbit]") 
			curUser:SendData(BotName, "Change your nick so it display your upload speed. Like this [0.8Mbit]Nickname, Then you are welcome back!") 
			curUser:SendData(BotName, "Not working? Look here - [URL]http://www.hompage.com[/URL] -") 
			curUser:Disconnect()
		elseif (slots ~= nil and slots > slot) then
			curUser:SendData(BotName, "You can only open "..slot.." slots.")
			curUser:SendData(BotName, "Kicked...")
			curUser:TempBan()
		end 
	end
end

function ValidateNick(curUser)
	if (strfind(curUser.sName, "%b[]%b[]%S+")) then
		curUser:SendData(BotName, "You can't have two prefixes.")
		return 0
	else
		local value,slot
		for value, slot in ISP do
			if (strlen(curUser.sName) >= strlen(value) and strsub(strlower(curUser.sName),1,strlen(value)) == strlower(value)) then  
				return 1,slot
			end 
		end 
	end
	return 0,0
end

Best regards, nErBoS
--## nErBoS Spot ##--

Robban

Can't get slotrules thing working :/ Nothing happen then I try to change slots whit a specific Prefix

nErBoS

Hi,

Try out this one...

-- Made by dEFiNE
-- Mod by nErBoS asked by Robban

BotName = "-Bot-" 

ISP = { 
	["[100Mbit]"] = 9,
	["[10Mbit]"] = 9,
	["[8Mbit]"] = 9,
	["[5Mbit]"] = 7,
	["[2.5Mbit]"] = 5,
	["[2Mbit]"] = 5,
	["[1Mbit]"] = 4,
	["[0.8Mbit]"] = 3,
	["[0.5Mbit]"] = 3,
	["[0.4Mbit]"] = 2,
	["[0.2Mbit]"] = 1,
	["[0.1Mbit]"] = 1,
} 

function Main() 
	frmHub:RegBot(BotName) 
end 


function NewUserConnected(curUser) 
	if (curUser.iProfile ~= 2) then
		local val,slot = ValidateNick(curUser)
		local s,e,slots = strfind(curUser.sMyInfoString, "S:(%d+)")
		if (val == 0) then
			curUser:SendData(BotName, "Your nick should includ one of this [100Mbit] or [10Mbit] or [8Mbit] or [5Mbit] or [2.5Mbit] or [2Mbit] or [1Mbit] or [0.8Mbit] or [0.5Mbit] or [0.4Mbit] or [0.2Mbit] or [0.1Mbit]") 
			curUser:SendData(BotName, "Change your nick so it display your upload speed. Like this [0.8Mbit]Nickname, Then you are welcome back!") 
			curUser:SendData(BotName, "Not working? Look here - [URL]http://www.hompage.com[/URL] -") 
			curUser:Disconnect()
		elseif (slots ~= nil and tonumber(slots) > tonumber(slot)) then
			curUser:SendData(BotName, "You can only open "..slot.." slots.")
			curUser:SendData(BotName, "Kicked...")
			curUser:TempBan()
		end 
	end
end

function DataArrival(curUser, data)
	if (strsub(data,1,7) == "$MyINFO" and curUser.iProfile ~= 2 and not curUser.bOperator) then
		local val,slot = ValidateNick(curUser)
		local s,e,slots = strfind(data, "S:(%d+)")
		if (val == 0) then
			curUser:SendData(BotName, "Your nick should includ one of this [100Mbit] or [10Mbit] or [8Mbit] or [5Mbit] or [2.5Mbit] or [2Mbit] or [1Mbit] or [0.8Mbit] or [0.5Mbit] or [0.4Mbit] or [0.2Mbit] or [0.1Mbit]") 
			curUser:SendData(BotName, "Change your nick so it display your upload speed. Like this [0.8Mbit]Nickname, Then you are welcome back!") 
			curUser:SendData(BotName, "Not working? Look here - [URL]http://www.hompage.com[/URL] -") 
			curUser:Disconnect()
		elseif (slots ~= nil and tonumber(slots) > tonumber(slot)) then
			curUser:SendData(BotName, "You can only open "..slot.." slots.")
			curUser:SendData(BotName, "Kicked...")
			curUser:TempBan()
		end 
	end
end

function ValidateNick(curUser)
	if (strfind(curUser.sName, "%b[]%b[]%S+")) then
		curUser:SendData(BotName, "You can't have two prefixes.")
		return 0
	else
		local value,slot
		for value, slot in ISP do
			if (strlen(curUser.sName) >= strlen(value) and strsub(strlower(curUser.sName),1,strlen(value)) == strlower(value)) then  
				return 1,slot
			end 
		end 
	end
	return 0,0
end

Best regards, nErBoS
--## nErBoS Spot ##--

Robban

Thx! This script works perfect now...

SMF spam blocked by CleanTalk