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
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
To Ensure They have it in front of their Name. Yes to make sure it is there before the login.Any country Code.
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
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
nErBoS, You Are the best! It Does everything I wanted it to do, Thank you so Much.
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.
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