Author Topic: Protection Scripts  (Read 33406 times)

DocBeat

  • Newbie
  • *
  • Posts: 43
Protection Scripts
« on: July 05, 2008, 07:53:49 PM »
Does anyone have any protection scripts for icechat?I've found some good for mIRC but they were too complicated to be converted.

Basically most handy protection scripts i found included op status protection making you able to counter
any deop or ban attempt against you by users with no higher level than yours and other less important -slap counters etc.

I'd love to have a complete script that does such tasks because icechat is far more friendly and attractive than mIRC everything is in the right place there i use it all the time except from times when things get rough in a channel and i need such scripts like the one i mentioned.

Thanks in advance anyone who may have such script and can post it.

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: Protection Scripts
« Reply #1 on: July 19, 2008, 03:22:12 PM »
ok.... Here Is An Op Status Protection Script. It Will Reop You On Deop, I Will Post 3 Depecding On Your Services. (By Snerf)

ChanServ Reop:
Code: [Select]
Sub ONOP(ModeSet,Nickname,Host,ModeSetter,ModeSetterHost,Channel,ServerNumber)
If ModeSet = "False" and NickName = MyNickname(ServerNumber) then
  SendCommand "/cs op " & channel,ServerNumber
End If
End Sub

BotServ !op:
Code: [Select]
Sub ONOP(ModeSet,Nickname,Host,ModeSetter,ModeSetterHost,Channel,ServerNumber)
If ModeSet = "False" and NickName = MyNickname(ServerNumber) then
  SendCommand "/msg " & channel & " !op",ServerNumber
End If
End Sub

BotServ !up:
Code: [Select]
Sub ONOP(ModeSet,Nickname,Host,ModeSetter,ModeSetterHost,Channel,ServerNumber)
If ModeSet = "False" and NickName = MyNickname(ServerNumber) then
  SendCommand "/msg " & channel & " !up",ServerNumber
End If
End Sub

Counter A Ban Attempt:
Code: [Select]
Sub ONBAN(NickName,Host,ModeSetter,ModeSetterHost,Channel,ServerNumber)
if ModeSet = "True" and NickName = MyNickName(ServerNumber) then
  'if your nickname was banned
  sendcommand "/mode " & channel & " -b " & NickName & "!*@*",servernumber
end if
end sub
~ Sam
~ Visit my website at http://www.TheCellist42.com

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #2 on: July 21, 2008, 05:34:57 AM »
Thanks a lot Cellist.

What about host mask banning how to counter that one - i already have this one from you:

Code: [Select]
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)
myhost = GetIdentifier("$host",servernumber)
if mode="+b *!*@" & myhost & " " then
SendCommand "/mode " & channel & " -b *!*@" & MyHost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
if mode="+b " &mynickname & " !*@ " & myhost & " " then
SendCommand "/mode " & channel & " -b " &mynickname & " !*@ " & MyHost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
End Sub
(by TheCellist42 :))
can you test it (it didn't work for me) -it really comes in handy while in channels,peace is never quaranteed.

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Protection Scripts
« Reply #3 on: July 21, 2008, 11:13:54 PM »
Code: [Select]
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)
myhost = GetIdentifier("$host",servernumber)
if mode="+b *!*@" & myhost & " " then
SendCommand "/mode " & channel & " -b *!*@" & MyHost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
if mode="+b " &mynickname & " !*@ " & myhost & " " then
SendCommand "/mode " & channel & " -b " &mynickname & " !*@ " & MyHost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
End Sub

Right now that script is case-sensitive, you might wanna make these changes to it:

Code: [Select]
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)

'if you do not have ops on the channel then the script does not need to run
If Not IsOp(GetIdentifier("$me"),Channel,ServerNumber) then Exit Sub

myhost = LCase(GetIdentifier("$host",servernumber))
if LCase(mode) = "+b *!*@" & myhost then
SendCommand "/mode " & channel & " -b *!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
if LCase(mode) = "+b " & LCase(mynickname) & "!*@" & myhost then
SendCommand "/mode " & channel & " -b " & mynickname & "!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
End Sub

also, this script won't work if multiple modes are set at once
« Last Edit: July 21, 2008, 11:15:40 PM by Morio »
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #4 on: July 22, 2008, 04:51:19 AM »
Have you tested that script for the host mask ban counter because seriously it doesn't work - here's what i did:

(IrCQnet)

I registered a room lets say #room and added a nick in aop list then joined with that nick,lets say its hostmask is
xxxxxx.xxxxxx.xxxxxx.IP

Then i oped a user in that room and told him to ban me like this
/mode #room +b *!*@xxxxxx.xxxxxx.xxxxxx.IP,
nothing happened though.According to the script shouldn't he be kicked?

Help plzz :(

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Protection Scripts
« Reply #5 on: July 22, 2008, 07:46:52 AM »
it works fine for me, but note that it won't work for hidden hostmasks (mode +x)
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #6 on: July 22, 2008, 09:53:55 AM »
IrCQnet has cloaked hostmasks (+x) can't anyone make ban counter script for such case?

I've seen it many times although it was a mIRC script and i have no idea how to make it work for icechat :(

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Protection Scripts
« Reply #7 on: July 22, 2008, 10:39:14 AM »
use this to get your own host:
Code: [Select]
MyHost = GetIdentifier("$nick(" & Channel & "," & MyNickname & ").host",ServerNumber)
allthough that contains your ident too, so you need this to get rid of that
Code: [Select]
MyHost = Mid(MyHost,Len(GetIdentifier("$ident"),ServerNumber)+1)
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #8 on: July 25, 2008, 09:44:08 AM »
Is this the way the script should be (it gives me an error)

Code: [Select]
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)

'if you do not have ops on the channel then the script does not need to run
If Not IsOp(GetIdentifier("$me"),Channel,ServerNumber) then Exit Sub

MyHost = GetIdentifier("$nick(" & Channel & "," & MyNickname & ").host",ServerNumber)
MyHost = Mid(MyHost,Len(GetIdentifier("$ident"),ServerNumber)+1)
if LCase(mode) = "+b *!*@" & myhost then
SendCommand "/mode " & channel & " -b *!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
if LCase(mode) = "+b " & LCase(mynickname) & "!*@" & myhost then
SendCommand "/mode " & channel & " -b " & mynickname & "!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
End Sub

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Protection Scripts
« Reply #9 on: July 26, 2008, 12:41:05 AM »
I didn't have access to icechat when writing the fix for the script so I wasn't able to test it, there's a couple small typos in the second line of my last post, and I found out that method doesn't work very well anyway, so use these three lines instead of the two lines I posted earlier instead:

Code: [Select]
MyNick = GetIdentifier("$me",ServerNumber)
MyHost = GetIdentifier("$nick(" & Channel & "," & MyNick & ").host",ServerNumber)
MyHost = Mid(MyHost,inStr(MyHost,"@")+1)
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #10 on: July 27, 2008, 07:36:05 AM »
Code: [Select]
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)

'if you do not have ops on the channel then the script does not need to run
If Not IsOp(GetIdentifier("$me"),Channel,ServerNumber) then Exit Sub

MyNick = GetIdentifier("$me",ServerNumber)
MyHost = GetIdentifier("$nick(" & Channel & "," & MyNick & ").host",ServerNumber)
MyHost = Mid(MyHost,inStr(MyHost,"@")+1)
if LCase(mode) = "+b *!*@" & myhost then
SendCommand "/mode " & channel & " -b *!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
if LCase(mode) = "+b " & LCase(mynickname) & "!*@" & myhost then
SendCommand "/mode " & channel & " -b " & mynickname & "!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
end if
End Sub

I used it like this and did the same test for it.Made someone ban me like this "/mode #channelname +b *!*@myhost" but nothing happened - any ideas?

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Protection Scripts
« Reply #11 on: July 27, 2008, 08:01:10 AM »
try changing this line:
Code: [Select]
if LCase(mode) = "+b *!*@" & myhost then
to:
Code: [Select]
if LCase(mode) = "+b *!*@" & LCase(MyHost) then
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #12 on: July 27, 2008, 07:22:45 PM »
I made the script like this using all the above:

Code: [Select]
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber)

'if you do not have ops on the channel then the script does not need to run
If Not IsOp(GetIdentifier("$me"),Channel,ServerNumber) then Exit Sub

MyNick = GetIdentifier("$me",ServerNumber)
MyHost = GetIdentifier("$nick(" & Channel & "," & MyNick & ").host",ServerNumber)
MyHost = Mid(MyHost,inStr(MyHost,"@")+1)

if LCase(mode) ="-o " & LCase(mynickname) then
SendCommand "/msg chanserv op " & channel & " " & MyNickName,ServerNumber
end if
if LCase(mode) ="+b " & LCase(mynickname) & "!*@*" then
SendCommand "/mode " & channel & " -b " & MyNickName &" !*@*",ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
        SendCommand "/mode " & channel & " +b " & modesetter &" !*@*",ServerNumber
end if
if LCase(mode) = "+b *!*@" & LCase(MyHost) then
SendCommand "/mode " & channel & " -b *!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
        SendCommand "/mode " & channel & " +b " & modesetter &" !*@*",ServerNumber
end if
if LCase(mode) = "+b " & LCase(mynickname) & "!*@" & myhost then
SendCommand "/mode " & channel & " -b " & mynickname & "!*@" & myhost,ServerNumber
SendCommand "/kick " & channel & " " & modesetter & " Do Not Ban Me",servernumber
        SendCommand "/mode " & channel & " +b " & modesetter &" !*@*",ServerNumber
end if
End Sub

Thanks Morio and TheCellist42,it works perfectly now.Do you have any other suggestions ;
I have two requests on it if possible,
1)In case one kicks me i'd like the script to make me rejoin the channel and also check first if i am banned,unban me and then join back (i use '/msg ChanServ unban #channelname username' for that purpose)
2)Right now this script counters any -o effort.Can i set it so that i can deop myself and if possible to let my buddies (ppl on my buddies list) deop me too?

Thnx for the help provided already.

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Protection Scripts
« Reply #13 on: July 27, 2008, 11:09:02 PM »
1) use the OnKick sub to get the rejoin. No need to check for bans, just send the unban command every time, it shouldn't cause any problems. you might wanna add a timer for the rejoin though, so the unban command has enough time to get through
2) add this line right after the onmode line
Code: [Select]
If ModeSetter = GetIdentifier("$me") then exit sub
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Protection Scripts
« Reply #14 on: July 28, 2008, 03:07:24 AM »
1)I added this Sub under the Sub ONMODE :

Code: [Select]
Sub ONKICK(Nickname,Host,Channel,WhoKicked,Reason,ServerNumber)
SendCommand "/msg chanserv unban " & channel & " " & MyNickName,ServerNumber
SendCommand "/join " & channel,ServerNumber
SendCommand "/mode " & channel & " +b " & WhoKicked &" !*@*",ServerNumber
End Sub

It works,unbans me and makes me rejoin but it usually doesn't have time to ban the one who kicked me(i get the msg 'you are not channel operator' because it casts the ban command before i get the +o) -
how do i set those timers?

2)The "If ModeSetter = GetIdentifier("$me") then exit sub" line works but i was wondering if i could add this check to the
"if LCase(mode) ="-o " & LCase(mynickname) then" if ,using a NOT operator (-if the modesetter isn't me-) but i am newbie in VB and i don't know how that is.

Also is there a way to let only my buddies deop me besides myself?
Sorry for the hussle and thnx