Log in
 

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

Log in

Started by Manonmoon72, 10 May, 2004, 00:18:24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Manonmoon72

I need a Script to check if users have a Country code in front of their name ie; [UK] [USA] and so on if it can be done or Im using Robocop can someone tell me how to do it? Thanks

nErBoS

#1
Hi,

Why do you want to check ?? For accepting only users with Country code on their nick ?? or to disconnect invalide Country code ??? Please be more especific.

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

Manonmoon72

#2
To Ensure They have it in front of their Name. Yes to make sure it is there before the login.Any country Code.

nErBoS

Hi,

Try this one then...

--Requested by Manonmoon72
--Made by nErBoS

countrycode = {
	"[UK]",
	"[USA]",
	"[PT]",
}	--Write in this Table The Country Code Accepted in your Hub

sBot = "Country-Code"

function Main()
	frmHub:RegBot(sBot)
end

function NewUserConnected(user, data)
	if (CheckCountryCode(user) == 0) then
		user:SendData(sBot, "You don't have a Country Code or a Strange Country Code.")
		user:SendData(sBot, "Please wirte in your nick your Country Code. eg [Country_Code]your_nick")
		user:Disconnect()
	end
end

function CheckCountryCode(user)
	local found = 0
	for i=1, getn(countrycode) do
		if (strsub(strlower(user.sName),1,strlen(countrycode[i])) == strlower(countrycode[i])) then
			found = 1
			break
		end
	end
	return found
end

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

pHaTTy

heh first thread ive looked at thats ptokax lua....heh little update for ya


--Requested by Manonmoon72
--Made by nErBoS

showacceptions = 1; --1 will show country codes they can use

countrycode = {
	"[UK]",
	"[USA]",
	"[PT]",
}	--Write in this Table The Country Code Accepted in your Hub

sBot = "Country-Code"

function Main()
	frmHub:RegBot(sBot)
end

function NewUserConnected(user, data)
	if (CheckCountryCode(user) == 0) then
		user:SendData(sBot, "You don't have a Country Code or a Strange Country Code.")
		user:SendData(sBot, "Please write in your nick your Country Code. eg [Country_Code]your_nick")
		if (showacceptions==1) then
			local cod = "\n\n"
			user:SendData(sBot, "Current country codes accepted are as follows: ")
			for country,code in countrycode do
				cod = cod.."\t"..code.."\n"
			end
			user:SendData(sBot,cod)
		end
		user:SendData(sBot,"Disconnecting...")
		user:Disconnect()
	end
end

function CheckCountryCode(user)
	local found = 0
	for i=1, getn(countrycode) do
		if (strsub(strlower(user.sName),1,strlen(countrycode[i])) == strlower(countrycode[i])) then
			found = 1
			break
		end
	end
	return found
end
Resistance is futile!

Manonmoon72

nErBoS, You Are the best! It Does everything I wanted it to do, Thank you so Much.

Manonmoon72

ok now I have another request can this script be made to redirect cause now I have a place to send people who do not have the prefix, and if it can be done will this not affect registered users I do not want ot have to get all the registered users to change their name. I know this is a lot to ask and if its too much to ask just say so. I am afterall very grateful for your efforts on the first one. thanks again.

nErBoS

#7
Hi,

Done...

--Requested by Manonmoon72
--Show Country Prefix Accept by (uk-kingdom)pH?tt?
--Made by nErBoS

showacceptions = 1	--1 will show country codes they can use
sRedAddy = "1.1.1."	--Address that users will be redirect if not have the allowed prefix

countrycode = {
	"[UK]",
	"[USA]",
	"[PT]",
}	--Write in this Table The Country Code Accepted in your Hub

sBot = "Country-Code"

function Main()
	frmHub:RegBot(sBot)
end

function NewUserConnected(user, data)
	if (CheckCountryCode(user) == 0) then
		user:SendData(sBot, "You don't have a Country Code or a Strange Country Code.")
		user:SendData(sBot, "Please write in your nick your Country Code. eg [Country_Code]your_nick")
		if (showacceptions == 1) then
			local cod = "\n\n"
			user:SendData(sBot, "Current country codes accepted are as follows: ")
			for country,code in countrycode do
				cod = cod.."\t"..code.."\n"
			end
			user:SendData(sBot,cod)
		end
		user:SendData(sBot,"Rederecting...")
		user:SendData("$ForceMove "..sRedAddy.."|")
	end
end

function CheckCountryCode(user)
	local found = 0
	for i=1, getn(countrycode) do
		if (strsub(strlower(user.sName),1,strlen(countrycode[i])) == strlower(countrycode[i])) then
			found = 1
			break
		end
	end
	return found
end

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

SMF spam blocked by CleanTalk