PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: andrue on 09 March, 2004, 23:33:37

Title: ip checker and another script
Post by: andrue on 09 March, 2004, 23:33:37
i have 2 scripts that i need>>

1) I want a script to check that people are actually from their school by checking their ip. for example, a person from UCLA will have 169.232 and their name will be [UCLA]name. if not,  it states in the chat that they are not from the right school, so i can warn or kick them.

the school tag/ ip's are:
169.232 for [ucla]name
128.54 for [ucsd]name
169.  for [ucb]name
120. for [usd]name

2) i want a script that makes it so, when some types "+whatever" or "!whatever" or "/whatever", it doesnt show it in the chatroom, but it does actually work, so when people put stuff like +rules, we dont have like 10 people doing it. just to stop spam.

thanks
Title:
Post by: nErBoS on 10 March, 2004, 00:09:09
Hi,

1? Request...

--Requested by andrue
--Made by nErBoS

Bot = "IP-Look"


function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
if ("169.232." == a.."."..b..".") then
if (strsub(user.sName,1,6) == "[ucla]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("128.54." == a.."."..b..".") then
if (strsub(user.sName,1,6) == "[ucsd]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("169." == a..".") then
if (strsub(user.sName,1,5) == "[ucb]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("120." == a..".") then
if (strsub(user.sName,1,5) == "[usd]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
else
end
end

Hope it helps.

2? Request..

Just put in the end of ever command "return 1"

Best regards, nErBoS
Title:
Post by: pHaTTy on 10 March, 2004, 00:17:21
QuoteOriginally posted by nErBoS
Hi,

1? Request...

--Requested by andrue
--Made by nErBoS

Bot = "IP-Look"


function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
if ("169.232." == a.."."..b..".") then
if (strsub(user.sName,1,6) == "[ucla]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("128.54." == a.."."..b..".") then
if (strsub(user.sName,1,6) == "[ucsd]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("169." == a..".") then
if (strsub(user.sName,1,5) == "[ucb]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("120." == a..".") then
if (strsub(user.sName,1,5) == "[usd]") then
else
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
else
end
end

Hope it helps.

2? Request..

Just put in the end of ever command "return 1"

Best regards, nErBoS

hmm couple tips to cut down

--Requested by andrue
--Made by nErBoS

Bot = "IP-Look"


function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
if ("169.232." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[ucla]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("128.54." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[ucsd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("169." == a..".") then
if not (strsub(user.sName,1,5) == "[ucb]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
elseif ("120." == a..".") then
if not (strsub(user.sName,1,5) == "[usd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school.")
end
end
end

cut down on the else's when possible and use not or ~=

etc later,,


PS: you have some text check againt a  local, try turn it other way around if a..b == sort of thing ;)
Title:
Post by: nErBoS on 10 March, 2004, 00:32:12
Hi,

Thanks phatty i willl take that in mind.

Best regards, nErBoS