Hi there,,
A script to make users immuned by their nick,,
-------
-- Immune script
-- !immune < to add a user immuned
-- !delimmune < to delete a user immuned
-- ?immune < show the current users immuned
function Main()
Bot = "YourBot"
ImmunesTotal = 0
ImmunesList = {}
ReadImmunes()
end
function ReadImmunes()
readfrom("Immune.lst")
while 1 do
local line = read()
if line == nil then
break
else
ImmunesTotal = ImmunesTotal + 1
rawset(ImmunesList,ImmunesTotal,line)
end
end
readfrom()
end
function WriteImmunes()
writeto("Immune.lst")
for i=1,ImmunesTotal,1 do
write(rawget(ImmunesList,i).."\n")
end
writeto()
end
function DeleteImmunes(opNick)
errlvl = 1
for i=1,ImmunesTotal,1 do
if rawget(ImmunesList,i) == opNick then
if i ~= ImmunesTotal then
rawset(ImmunesList,i,rawget(ImmunesList,ImmunesTotal))
end
ImmunesTotal = ImmunesTotal - 1
SortImmunes()
WriteImmunes()
errlvl = 0
break
end
end
-- returns 1 if Immune could not be found
return errlvl
end
function AddImmunes(opNick)
errlvl = CheckUserNickImmune(opNick)
if errlvl == 0 then
ImmunesTotal = ImmunesTotal + 1
rawset(ImmunesList,ImmunesTotal,opNick)
SortImmunes()
WriteImmunes()
end
-- returns 1 if Immune already exists
return errlvl
end
function SortImmunes()
for passNum=1,ImmunesTotal-1,1 do
for i=1,ImmunesTotal-passNum,1 do
if rawget(ImmunesList,i) > rawget(ImmunesList,i+1) then
tempNick = rawget(ImmunesList,i)
rawset(ImmunesList,i,rawget(ImmunesList,i+1))
rawset(ImmunesList,i+1,tempNick)
end
end
end
end
function ShowImmunes(user)
nickimmune = 0
nickimmunelist = ""
for i=1,ImmunesTotal,1 do
nickimmunelist = nickimmunelist..rawget(ImmunesList,i).."\r\n"
nickimmune = nickimmune+1
end
if nickimmune > 0 then
nickfound = "***Current users Immuned by their Nick are listed as:\r\n"..nickimmunelist
else
nickfound = "***None users immuned by their Nick found."
end
user:SendData(Bot,"\r\n"..nickfound)
end
function DoAddImmunes(user, data)
arg = GetArgML(data)
if arg ~= nil then
if AddImmunes(arg) == 1 then
user:SendData(Bot,"User "..arg.." is already Immune!")
else
SendToOps(Bot, user.sName.." just made "..arg.." a Immune!")
user:SendData(Bot,"You just made "..arg.." a Immune!")
SendToNick(arg, "<"..Bot.."> "..user.sName.." just made you a Immune!")
end
else
user:SendData(Bot, "You provided insufficient information for me to run the specified command.")
end
end
function DoDeleteImmunes(user, data)
arg = GetArgML(data)
if arg ~= nil then
if DeleteImmunes(arg) == 1 then
user:SendData(Bot,"User "..arg.." was not found in the current Immune list!")
else
SendToOps(Bot, user.sName.." just revoked Immune status from: "..arg)
user:SendData(Bot,"You just revoked Immune status from: "..arg)
SendToNick(arg, "<"..Bot.."> "..user.sName.." just revoked your Immune status.")
end
else
user:SendData(Bot, "You provided insufficient information for me to run the specified command.")
end
end
function CheckNickImmune(user)
found = 0
for i=1,ImmunesTotal,1 do
if rawget(ImmunesList,i) == user.sName then
found = 1
break
end
end
-- returns 1 if user specified is Immuned
return found
end
function CheckUserNickImmune(opNick)
errlvl = 0
for i=1,ImmunesTotal,1 do
if rawget(ImmunesList,i) == opNick then
errlvl = 1
break
end
end
-- returns 1 if user specified is Immuned
return errlvl
end
function GetArgML(data)
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
return arg
end
function DataArrival(user,data)
if (strsub(data,1,1)=="<") or (strsub(data,1,4)=="$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!addimmune" or cmd == "!immune") then
if user.bOperator then
DoAddImmunes(user,data)
return 1
end
elseif (cmd=="!deleteimmune" or cmd == "!delimmune") then
if user.bOperator then
DoDeleteImmunes(user,data)
return 1
end
elseif (cmd=="!showimmune" or cmd == "?immune") then
if user.bOperator then
ShowImmunes(user)
return 1
end
end
end
end
function OpConnected(user)
immune=CheckNickImmune(user)
if immune == 1 then
user:SendData(Bot, "Welcom there, lucky guy,... ;o)")
else
-- Do Your Code There
end
end
function NewUserConnected(user)
immune=CheckNickImmune(user)
if immune == 1 then
user:SendData(Bot, "Welcom there, lucky guy,... ;o)")
else
-- Do Your Code There
end
end
-------
l8tr, ;)
Hi?,,
Updated, about some immune functions on Ips,, :)
That one is not tested,,... so,, to test... :))
Hub owner can enter >manually< some Ips in the file 'IpImmune.lst',... then, those Ips should be immuned on a '!banip',...
-----
-- Immune-example script v1.1, By Guibs
-- Added Ip immune list (IpImmune.lst) to show an other example about immune functions on Ip
-- !immune < to add a user immuned
-- !delimmune < to delete a user immuned
-- ?immune < show the current users immuned
-- This is just an example about the way to make some users immuned
function Main()
Bot = "YourBot"
ImmunesTotal = 0
ImmunesList = {}
IpImmunesTotal = 0
IpImmunesList = {}
ReadImmunes()
ReadIpImmunes()
end
function ReadImmunes()
readfrom("Immune.lst")
while 1 do
local line = read()
if line == nil then
break
else
ImmunesTotal = ImmunesTotal + 1
rawset(ImmunesList,ImmunesTotal,line)
end
end
readfrom()
end
function ReadIpImmunes()
readfrom("IpImmune.lst")
while 1 do
local line = read()
if line == nil then
break
else
IpImmunesTotal = IpImmunesTotal + 1
rawset(IpImmunesList,IpImmunesTotal,line)
end
end
readfrom()
end
function WriteImmunes()
writeto("Immune.lst")
for i=1,ImmunesTotal,1 do
write(rawget(ImmunesList,i).."\n")
end
writeto()
end
function DeleteImmunes(opNick)
errlvl = 1
for i=1,ImmunesTotal,1 do
if rawget(ImmunesList,i) == opNick then
if i ~= ImmunesTotal then
rawset(ImmunesList,i,rawget(ImmunesList,ImmunesTotal))
end
ImmunesTotal = ImmunesTotal - 1
SortImmunes()
WriteImmunes()
errlvl = 0
break
end
end
-- returns 1 if Immune could not be found
return errlvl
end
function AddImmunes(opNick)
errlvl = CheckUserNickImmune(opNick)
if errlvl == 0 then
ImmunesTotal = ImmunesTotal + 1
rawset(ImmunesList,ImmunesTotal,opNick)
SortImmunes()
WriteImmunes()
end
-- returns 1 if Immune already exists
return errlvl
end
function SortImmunes()
for passNum=1,ImmunesTotal-1,1 do
for i=1,ImmunesTotal-passNum,1 do
if rawget(ImmunesList,i) > rawget(ImmunesList,i+1) then
tempNick = rawget(ImmunesList,i)
rawset(ImmunesList,i,rawget(ImmunesList,i+1))
rawset(ImmunesList,i+1,tempNick)
end
end
end
end
function ShowImmunes(user)
nickimmune = 0
nickimmunelist = ""
for i=1,ImmunesTotal,1 do
nickimmunelist = nickimmunelist..rawget(ImmunesList,i).."\r\n"
nickimmune = nickimmune+1
end
if nickimmune > 0 then
nickfound = "***Current users Immuned by their Nick are listed as:\r\n"..nickimmunelist
else
nickfound = "***None users immuned by their Nick found."
end
user:SendData(Bot,"\r\n"..nickfound)
end
function DoAddImmunes(user, data)
arg = GetArgML(data)
if arg ~= nil then
if AddImmunes(arg) == 1 then
user:SendData(Bot,"User "..arg.." is already Immune!")
else
SendToOps(Bot, user.sName.." just made "..arg.." a Immune!")
user:SendData(Bot,"You just made "..arg.." a Immune!")
SendToNick(arg, "<"..Bot.."> "..user.sName.." just made you a Immune!")
end
else
user:SendData(Bot, "You provided insufficient information for me to run the specified command.")
end
end
function DoDeleteImmunes(user, data)
arg = GetArgML(data)
if arg ~= nil then
if DeleteImmunes(arg) == 1 then
user:SendData(Bot,"User "..arg.." was not found in the current Immune list!")
else
SendToOps(Bot, user.sName.." just revoked Immune status from: "..arg)
user:SendData(Bot,"You just revoked Immune status from: "..arg)
SendToNick(arg, "<"..Bot.."> "..user.sName.." just revoked your Immune status.")
end
else
user:SendData(Bot, "You provided insufficient information for me to run the specified command.")
end
end
function CheckNickImmune(user)
found = 0
for i=1,ImmunesTotal,1 do
if rawget(ImmunesList,i) == user.sName then
found = 1
break
end
end
-- returns 1 if user specified is Immuned
return found
end
function CheckUserNickImmune(opNick)
errlvl = 0
for i=1,ImmunesTotal,1 do
if rawget(ImmunesList,i) == opNick then
errlvl = 1
break
end
end
-- returns 1 if user specified is Immuned
return errlvl
end
function GetArgML(data)
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
return arg
end
function GetLongArgML(data)
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(.+)*")
return arg
end
function DataArrival(user,data)
if (strsub(data,1,1)=="<") or (strsub(data,1,4)=="$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!addimmune" or cmd == "!immune") then
if user.bOperator then
DoAddImmunes(user,data)
return 1
end
elseif (cmd=="!deleteimmune" or cmd == "!delimmune") then
if user.bOperator then
DoDeleteImmunes(user,data)
return 1
end
elseif (cmd=="!showimmune" or cmd == "?immune") then
if user.bOperator then
ShowImmunes(user)
return 1
end
elseif (cmd=="!banip") then
if user.bOperator then
BanIp(user,data)
end
end
end
end
function OpConnected(user)
immune=CheckNickImmune(user)
if immune == 1 then
user:SendData(Bot, "Welcom there, lucky guy,... ;o)")
else
-- Do Your Code There
end
end
function NewUserConnected(user)
immune=CheckNickImmune(user)
if immune == 1 then
user:SendData(Bot, "Welcom there, lucky guy,... ;o)")
else
-- Do Your Code There
end
end
function BanIp(user,data)
arg = GetLongArgML(data)
if arg ~= nil then
ipimmune = CheckIpImmunes(arg)
if ipimmune == 1 then
SendToOps(Bot, user.sName.." has tried to ban "..arg.." as it was an Ip immuned,... Bo0h!!")
user:SendData(Bot,"You can't do a BanIp on such Ip!")
return 1
else
end
else
user:SendData(Bot, "You provided insufficient information for me to run the specified command.")
end
end
function CheckIpImmunes(arg)
ipimmune = 0
for a,b, in IpImmunesList do
if arg == b then
ipimmune == 1
end
end
return ipimmune
end
-----
Hoping it works,,
Good test & script with this example,, :)
l8tr,, ;o)
excellent when i lost all my scripts in hdd failure, i never did find that one :))
ty guibs nearly re-done my collection wooo loool :))
guibs
thanks alot was waiting fo this one. ';))
now one request left
can you make it so that it also logs the one who trys to kick the users in immunelist?
and as far as i understand if i want to make a command not to work i need to put [--] infront of that line? right?
will test this script as soon as i got my comp back online
had a crash last thursday and i couldnt fix the prob so i had to bring it to the shop (:- but hopefully it will be back on monday.
then i will test it.
syntax error `in* expected;
last token read `; at line 261 in string "--immune-example script v1.1 By Guibs
-what does it mean??
Hi there,,
Phatty,
pleasure to help, m8,, ;o)
Catch u soon on checkers,,... when you learn a few more about,... ^^
[NL]trucker,,
yw too,, ;)
> can you make it so that it also logs the one who trys to kick the users in immunelist? < if i get it & if you want,, a message could be send to the ops on a 'bad kick', yep, .. tell me if i get your request,... :)
Snooris,
Be sure to take & use the code after the line:
----
> code: <
----
I get none syntax error on a simple restart script there,...
l8tr,, ;)
hmm sorry guibs you just aint good enuff :P beat ya in that one ;)
erf,... easy,.... you give up on the revenge,... ;)
loooooooool whatevr :P
Guibs
> can you make it so that it also logs the one who trys to kick the users in immunelist?
< if i get it & if you want,, a message could be send to the ops on a 'bad kick', yep, .. tell me if i get your request,... :)
almost m8 i just want it to LOG the one who tried to kick a immune user.
No need for messages send to the OPs
btw
do i need to make the log-files or are they made automatticly?
and if so where are they placed?
sorry m8 ;(
i have a problem/bug
in this section function CheckIpImmunes(arg)
ipimmune = 0
for a,b, in IpImmunesList do
if arg == b then
ipimmune == 1
end
end
return ipimmune
Syntax error: `in' expected;
last token read: `,' at line 243 in file `E:\==DC==\ptotaxbuild15.16\scripts\immune.lua'
dont know what is wrong (:-
for a,b, in IpImmunesList do
after a,b is an , 2 much.
plop
QuoteOriginally posted by plop
for a,b, in IpImmunesList do
after a,b is an , 2 much.
plop
noticed that to after a while :]
another one
i have removed the second , now i get this:
Syntax error: `=' expected;
last token read: `==' at line 245 in file `E:\==DC==\ptotaxbuild15.16\scripts\immune.lua'
in this section function CheckIpImmunes(arg)
ipimmune = 0
for a,b in IpImmunesList do
if arg == b then
ipimmune == 1 <--line 245
end
end
return ipimmune
QuoteOriginally posted by [NL]trucker
another one
i have removed the second , now i get this:
Syntax error: `=' expected;
last token read: `==' at line 245 in file `E:\==DC==\ptotaxbuild15.16\scripts\immune.lua'
in this section function CheckIpImmunes(arg)
ipimmune = 0
for a,b in IpImmunesList do
if arg == b then
ipimmune == 1 <--line 245
end
end
return ipimmune
it expects 1 = not 2.
plop
Thnx m8
that did it :-))
working fine now Guibs thanks alot to all off you .
I installed the script and I get this....
Syntax Error: `in' expected;
last token read: `,' at line 244 in string "
..."
the script looks like this at the moment...
function CheckIpImmunes(arg)
ipimmune = 0
for a,b, in IpImmunesList do
if arg == b then
ipimmune == 1
end
end
return ipimmune
end
I read the other replies and I dont under stand what to do. I tried to fix it and it still gave the the same problem. PLease any help would be nice. :rolleyes:
QuoteOriginally posted by Ricky12
I installed the script and I get this....
Syntax Error: `in' expected;
last token read: `,' at line 244 in string "
..."
the script looks like this at the moment...
function CheckIpImmunes(arg)
ipimmune = 0
for a,b, in IpImmunesList do
if arg == b then
ipimmune == 1
end
end
return ipimmune
end
I read the other replies and I dont under stand what to do. I tried to fix it and it still gave the the same problem. PLease any help would be nice. :rolleyes:
check back and change the next marked lines.
function CheckIpImmunes(arg)
ipimmune = 0
for a,b, in IpImmunesList do <-------------- remove the , after the b
if arg == b then
ipimmune == 1 <----------------- remove 1 =
end
end
return ipimmune
end
thats all.
plop
Thanks it works now!!! Keep up the good work!! :] And I look foward to downloading more scripts. ;)
Syntax Error: `then' expected;
last token read: `=' at line 230
thats an error i get and sadly i dnt understand it.....i think ma new years resolution is 2 learn LUA *-) :-p
plz sum1 help me with that cos i've stared at it 4 ages but still i'm useless.
Thanx
Devastator
devastator
look in the posts above and then post your question like we all did maybey then we can help ya.
so post the piece where it is all about.
QuoteSyntax error: `=' expected;
last token read: `==' at line 245 in file `E:\==DC==\ptotaxbuild15.16\scripts\immune.lua'
in this section function CheckIpImmunes(arg)
ipimmune = 0
for a,b in IpImmunesList do
if arg == b then
ipimmune == 1 <--line 245
end
end
return ipimmune
something like this.
Only thing - I still can kick immune users.. Can someone fix this little bug in this script??
Please, someone help me! My problem is, that I want to make some users immune from kicks, but I dont want them give any special profile! If you cant edit this one, then please give me something better! Please!