hello ppl
i would like to convert this script in LUA 5 if anyone can help me i would appriciate that
i hope it s not to hard for someone with knowlege on this baby =o)
code :
========================================
-----------------------------------------------------------------------------------
--rdprotection.lua by Romulus (C) 2003-04-09
--RomulusHubSecurity-addon3
--
--Protects the hub from vigilant Operators redirecting all users to another hub.
--
--
-----------------------------------------------------------------------------------
--Enter your admins names (or atleast those who should have the
--ability to turn this function off - and don΄t forget to give
--them the magic word in a safe environment):
admins = {"LiqUiD~TrolL"}
botname="-RD-Protection-"
--Choose a magicword. This word is used if you want to turn off the function.
--There is no help in this script, that would be stupid ;)
--You have to remember your magic word, and the command to turn of the rdprotection.
--
--Note: Even when the function is turned off only Operators listed above can redirect users.
--Ordinary operators will always get kicked ;)
--
--To turn off the rd protection type:
-- +rdprotect off YourMagicWord in a pm to the bot
--To turn it back on again:
-- +rdprotect on YourMagicWord in a pm to the bot
TheMagicWord="liquid"
--------You can, but should not edit these:
rdwarn = 3
rdwarn2 = 5
rddiss = 10
rdban = 15
-------------------------------------------------
---DO NOT EDIT BELOW THIS TEXT!!!
-------------------------------------------------
EnableRedirr=0
function Main()
frmHub:RegBot(botname)
SendToOps(botname, "This hub is now protected against OpForceMove! ("..ver..")")
end
redirr={}
redirrCounter=0
function checkAdmath.min(user)
Admath.min = 0
for key, CheckOp in admins do
if user.sName == CheckOp then
Admath.min = 1
end
end
end
ver="RomulusHubSecurity-Addon3"
function DataArrival(user, data)
s,e,whoTo,from=string.find(data, "$To:%s+(%S+)%s+From:%s+(%S+)")
if whoTo==botname then
s,e,cmd,arg,magicword = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)" )
if (user.bOperator) then
checkAdmath.min(user)
if Admin==1 then
if (cmd=="+rdprotect") then
magicword=string.sub(magicword,1,string.len(magicword)-1)
if (arg=="off") then
if (magicword==TheMagicWord) then
EnableRedirr=1
user:SendPM(botname, "You said the magic word! I will now allow Admins to redirect users.")
end
end
end
if (cmd=="+rdprotect") then
magicword=string.sub(magicword,1,string.len(magicword)-1)
if (arg=="on") then
if (magicword==TheMagicWord) then
EnableRedirr=0
user:SendPM(botname, "You said the magic word! The RD-Protection is now enabled. Not even Admins can redirect users.")
end
end
end
end
end
end
if string.sub(data, 1, 12) == "$OpForceMove" then
checkAdmath.min(user)
if Admin==0 then
if (redirr[user.sName] == nil) then
redirr[user.sName]=1
else
redirr[user.sName]=redirr[user.sName]+1
end
redirrCounter=redirrCounter+1
SendToOps(botname,"The Operator "..user.sName.." with ip "..user.sIP.." has OpForceMoved << "..redirr[user.sName].." >> users.")
if (redirrCounter==rdwarn) then
SendPmToNick(user.sName, botname, "Watch it "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter==rdwarn2) then
SendPmToNick(user.sName, botname, "Last warning "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter>=rddiss) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and are therefore disconnected!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore disconnected!")
user:Disconnect()
end
if (redirrCounter>=rdban) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and are therefore banned!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore banned!")
user:Ban()
end
end
end
if Admin==1 then
if EnableRedirr==0 then
if (redirr[user.sName] == nil) then
redirr[user.sName]=1
else
redirr[user.sName]=redirr[user.sName]+1
end
redirrCounter=redirrCounter+1
SendToOps(botname,"The Operator "..user.sName.." with ip "..user.sIP.." has OpForceMoved << "..redirr[user.sName].." >> users.")
if (redirrCounter==rdwarn) then
SendPmToNick(user.sName, botname, "Watch it "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter==rdwarn2) then
SendPmToNick(user.sName, botname, "Last warning "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter>=rddiss) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and are therefore disconnected!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore disconnected!")
user:Disconnect()
end
if (redirrCounter>=rdban) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and you are therefore banned!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore banned!")
user:Ban()
end
end
end
end
Just take away redirect from OP's in Profile manager. :)
Try this:
-----------------------------------------------------------------------------------
--rdprotection.lua by Romulus (C) 2003-04-09 --RomulusHubSecurity-addon3 --
--Protects the hub from vigilant Operators redirecting all users to another hub. -- --
-----------------------------------------------------------------------------------
--Converted to LUA 5 by jiten and dessamator (damn, u'r a killer :] )
--Enter your admins names (or atleast those who should have the
--ability to turn this function off - and don΄t forget to give
--them the magic word in a safe environment):
admins = {"LiqUiD~TrolL"} -- put admin name here
botname="-RD-Protection-"
--Choose a magicword. This word is used if you want to turn off the function.
--There is no help in this script, that would be stupid ;)
--You have to remember your magic word, and the command to turn of the rdprotection.
-- --Note: Even when the function is turned off only Operators listed above can redirect users.
--Ordinary operators will always get kicked ;) -- --To turn off the rd protection type:
-- +rdprotect off YourMagicWord in a pm to the bot --To turn it back on again:
-- +rdprotect on YourMagicWord in a pm to the bot
TheMagicWord="liquid"
--------You can, but should not edit these:
rdwarn = 3
rdwarn2 = 5
rddiss = 10
rdban = 15
-------------------------------------------------
---DO NOT EDIT BELOW THIS TEXT!!!
-------------------------------------------------
EnableRedirr=0
function Main()
frmHub:RegBot(botname)
SendToOps(botname, "This hub is now protected against OpForceMove! ("..ver..")")
end
redirr={}
redirrCounter=0
function checkAdmin(user)
Admin = 0
for key, CheckOp in admins do
if user.sName == CheckOp then
Admin = 1
end
end
end
ver="RomulusHubSecurity-Addon3"
function ToArrival(user, data)
s,e,whoTo,from=string.find(data, "$To:%s+(%S+)%s+From:%s+(%S+)")
if whoTo==botname then
s,e,cmd,arg,magicword = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)" )
if (user.bOperator) then
checkAdmin(user)
if (cmd=="+rdprotect") and (Admin==1) then
magicword=string.sub(magicword,1,string.len(magicword)-1)
if (arg=="off") then
if (magicword==TheMagicWord) then
EnableRedirr=1
user:SendPM(botname, "You said the magic word! I will now allow Admins to redirect users.")
end
elseif (arg=="on") then
if (magicword==TheMagicWord) then
EnableRedirr=0
user:SendPM(botname, "You said the magic word! The RD-Protection is now enabled. Not even Admins can redirect users.")
else
user:SendPM(botname, "You are not an admin, & correct syntax is :+rdprotect off YourMagicWord")
end
end
end
end
end
end
function OpForceMoveArrival(user, data)
if string.sub(data, 1, 12) == "$OpForceMove" then
checkAdmin(user)
if Admin==0 then
if (redirr[user.sName] == nil) then
redirr[user.sName]=1
else
redirr[user.sName]=redirr[user.sName]+1
end
redirrCounter=redirrCounter+1
SendToOps(botname,"The Operator "..user.sName.." with ip "..user.sIP.." has OpForceMoved << "..redirr[user.sName].." >> users.")
if (redirrCounter==rdwarn) then
SendPmToNick(user.sName, botname, "Watch it "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter==rdwarn2) then
SendPmToNick(user.sName, botname, "Last warning "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter>=rddiss) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and are therefore disconnected!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore disconnected!")
user:Disconnect()
end
if (redirrCounter>=rdban) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and are therefore banned!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore banned!")
user:Ban()
end
end
end
if Admin==1 then
if EnableRedirr==0 then
if (redirr[user.sName] == nil) then
redirr[user.sName]=1
else
redirr[user.sName]=redirr[user.sName]+1
end
redirrCounter=redirrCounter+1
SendToOps(botname,"The Operator "..user.sName.." with ip "..user.sIP.." has OpForceMoved << "..redirr[user.sName].." >> users.")
if (redirrCounter==rdwarn) then
SendPmToNick(user.sName, botname, "Watch it "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter==rdwarn2) then
SendPmToNick(user.sName, botname, "Last warning "..user.sName.."! This hub is protected against OpForceMove. If you redirect to many users, you will be banned.")
end
if (redirrCounter>=rddiss) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and are therefore disconnected!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore disconnected!")
user:Disconnect()
end
if (redirrCounter>=rdban) then
SendPmToNick(user.sName, botname, "<< Taking protective actions >>> You have redirected to many users "..user.sName..", and you are therefore banned!")
SendToAll(botname, "<< Taking protective actions >>> "..user.sName.." have redirected to many users, and is therefore banned!")
user:Ban()
end
end
end
end
btw LiqUiD~TrolL, try using the [ CODE ] [ /CODE ] thing.
it's that when u post the scripts without them, everything seems distorted and it's hard do understand the code itself.
cheers
well the script doesnt seems to work
i get and error message
Syntax ....3.3.0.b16.04_nt_DCinfo.insecure.lv_\scripts\redirectprotection.lua5.lua:288: unexpected symbol near `17.03'
well any i deas to fix it ??????
hmm no syntax errors here, maybe u copied something and l8r replaced it, dunno, try copying it again !, btw im quite sure u did copy something extra, 17.03 is the exact date in which the script was posted !
Yups, maybe u didn't copy it well, cuz, i don't get any syntax error and the script doesn't contain any "17.03" :D
Btw, the code is between the:
Best regards,
jiten
ok hehe i copy paste it good this time =)
hehe i m sooo .......
=)
QuoteOriginally posted by LiqUiD~TrolL
ok hehe i copy paste it good this time =)
hehe i m sooo .......
=)
There is an Edit Post button on the top right of every of your posts.. incase you havent noticed ;)
yup roger that, i ve already notice it =)
anyway tnx for the help