PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: acrespo on 18 October, 2003, 20:23:22

Title: ISP Block
Post by: acrespo on 18 October, 2003, 20:23:22
I need a script to block all users don't have some ISPs.
If a user don't have [WAS],
 (and other ISPs setting in the script), this user will disconnect with a message.
Title:
Post by: BlazeXxX on 19 October, 2003, 04:12:07
Hi there,
Are you only talking about the Prefixs or the actualy IP ranges of the ISPs ?

If this is what you wanting to do, just add a nick rule in ptokax soft:

(\[BBB\]|\[ISP1\]|\[512k\]|\[BT\])

Just add the nick prefixs u want to allow in... Sorry If i got the wrong understanding of your question  :rolleyes:
Title:
Post by: acrespo on 19 October, 2003, 19:25:41
I already found a script to do a ISP block. See below:
BotName = "NickCheck"
ISP = {"[BR]","[WAS]"}

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


function NewUserConnected(curUser)

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

if (x == 0) then
-- Kick user
curUser:SendPM(BotName, "")
curUser:SendPM(BotName, "You need a correct ISP to connect in this Hub. Write [WAS] or [BR] in your nickname. Example: [WAS]MyUser.")
curUser:Disconnect()
end
end



Only not registered user are checked by this script.
Title:
Post by: klownietklowniet on 20 October, 2003, 02:14:35
This is another version I made a little while ago. It just check for a tag, not a specific one. So all users without tags get dicsonnected. Nice feature is the bugging... :-)


-- Date: 25-09-2003
--
-- code from klownietklowniet
-- network: [ > DC - UniteD < ]
--
-- Request by Snake
--
-- version 2.0
--
-- Note1: To work it has to be started before a user connects
-- Note2: BugTime is the time, in seconds, between every pm warning!
--
-- Fix: Message not sent to registered users (thanks to [DK]MR-Kandis for the suggestion)

BotName = "ISPBugger"
BugTime = 5
BugMessage = "Please put your isp or country code in front of your nick in brackets [] and you will not see this pm again."

bug = {}

function Main()
   secBugTime = BugTime * 1000
   SetTimer(secBugTime)
   StartTimer()
end

function NewUserConnected(curUser)

   if curUser.iProfile < 0 then
      if strfind(curUser.sName, "^(%[%S+%])") or strfind(curUser.sName, "^(%(%S+%))") then

      else
         curUser:SendPM(BotName,BugMessage)
         bug[curUser.sName] = curUser.sIP
      end
   end
end


function UserDisconnected(curUser)
   if curUser.iProfile < 0 then
      bug[curUser.sName] = nil
   end
end

function OnTimer()
   for n, i in bug do
      local tmpuser = GetItemByName(n)
      if tmpuser ~= nil then
         tmpuser:SendPM(BotName,BugMessage)
      end
   end
end


Title:
Post by: sajy2k on 03 January, 2004, 19:36:44
QuoteOriginally posted by acrespo
I already found a script to do a ISP block. See below:
BotName = "NickCheck"
ISP = {"[BR]","[WAS]"}

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


function NewUserConnected(curUser)

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

if (x == 0) then
-- Kick user
curUser:SendPM(BotName, "")
curUser:SendPM(BotName, "You need a correct ISP to connect in this Hub. Write [WAS] or [BR] in your nickname. Example: [WAS]MyUser.")
curUser:Disconnect()
end
end



Only not registered user are checked by this script.

I got this message Syntax Error: `)' expected (to close `(' at line 28);
  last token read: `curUser' at line 29 in string "BotName = "NickCheck"
..."
Title: cool
Post by: [SWE]henrik on 04 January, 2004, 02:47:37
QuoteOriginally posted by klownietklowniet
This is another version I made a little while ago. It just check for a tag, not a specific one. So all users without tags get dicsonnected. Nice feature is the bugging... :-)

this is a nice one, ill save it for later, keep it up
Title:
Post by: sajy2k on 04 January, 2004, 12:01:38
-- Bad Nick kicker by Sajy2k?
-- Added the excact opposite ;-)

forbiddenNicks = {"$","^","|","%","*"}
forcedNicks = {"[Tags]"}
Bot = "[Botname]"

function Main()
frmHub:RegBot(Bot)
end

function checkNickWords(nick,curUser)
for key,word in forbiddenNicks do
if strfind(strlower(nick), strlower(word),1,1) then
curUser:SendPM(Bot, word.." is not allowed to have in a nick! Change your nick and reconnect!")
return 1
end
end
end

function doCheckForcedNicks(usernick)
for key,nick in forcedNicks do
if strfind(strlower(usernick),strlower(nick),1,1) then return end
end return 1
end

function ShowForced()
line = ""
for key,a in forcedNicks do
line = line..a..", "
end
return line
end

function NewUserConnected(curUser)
if checkNickWords(curUser.sName, curUser) then
curUser:Disconnect()
elseif doCheckForcedNicks(curUser.sName) then
curUser:SendPM(Bot, "You must have [Tags] tags in front of your nick to enter this hub and with [ ] and not ( ) for example: [Tags] Nickname")
curUser:Disconnect()
end
end