IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: SniperPro on July 08, 2008, 03:54:16 AM

Title: !warn Script
Post by: SniperPro on July 08, 2008, 03:54:16 AM
I came up with this idea while I was getting pissed a player in a hangout channel for spam, and for disobeying other rules, and I don't like to kick and ban people, I think its unfair..

So I came up with the idea of a !warn script.

So that I can !warn <member> when they do something wrong to give them a warning to straighten up.

They get 3 warnings.

If they reach 3, a 1 long ban.

I want to know if anyone can make me this script?

If someone does it will be MUCH appreciated.
Title: Re: !warn Script
Post by: SniperPro on July 09, 2008, 01:15:37 AM
Also it would be nice if there could be a !unwarn command.

And make this so that it is only able to be used by me.
Title: Re: !warn Script
Post by: SniperPro on July 09, 2008, 03:25:53 AM
And another thing that would be nice to have is a !warni script.

So that if I type !warni <member> it shows there warn level.

(That command can be used by anyone).
Title: Re: !warn Script
Post by: Snerf on July 09, 2008, 11:21:49 AM
How do you want to give them a warning?
Title: Re: !warn Script
Post by: SniperPro on July 09, 2008, 07:56:21 PM
You have been warned for <reason>. (1/3)

And I mean (1/3) to show how many warns he has and how many he has left.

And and you throw in some colors? lol, like orange, and then once you get to the reason, red, then orange again.

So the total commands would be.

!warn

!unwarn

!warni
Title: Re: !warn Script
Post by: Snerf on July 09, 2008, 10:49:34 PM
Do you want to send them a private message, channel message, notice?
Title: Re: !warn Script
Post by: SniperPro on July 09, 2008, 10:53:50 PM
I would like for it to be a channel message.
Title: Re: !warn Script
Post by: Snerf on July 11, 2008, 11:01:54 AM
Ok, here is the script, it does not set a timed ban, it simply sets a ban.
It tries to get the users host from the IAL, if not, it will just ban the nickname.

Paste this into the Script Editor, and save it as a IceChat 5 Script file.
If you want to change the message colors for each warning number, simply
change the numbers (Which are the Color Code Numbers) at the beginning of the script.
This script will work in any channel on any server, and settings are saved by nickname.

All these commands can only be used by you, except for the !warni , which can be used by you, or anyone else.

Code: [Select]
Dim WarnColors(3)
WarnColors(1) = 8
WarnColors(2) = 7
WarnColors(3) = 4

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
if left(Message,7) = "!warni " then
    'get the nickname
    if len(Message) > 7 then
        nick = mid(OutGoingText,8)
        ShowCWarning nick,Channel,ServerNumber
    end if   
end if
End Sub

Function OUTTEXT(OutgoingText)
if left(OutGoingText,6) = "!warn " then
    SendCommand OutGoingText
    'get the nickname
    if len(OutGoingText) > 6 then
        nick = mid(OutGoingText,7)
        AddWarning nick
    end if   
elseif left(OutGoingText,7) = "!warni " then
    SendCommand OutGoingText
    'get the nickname
    if len(OutGoingText) > 7 then
        nick = mid(OutGoingText,8)
        ShowWarning nick
    end if   
elseif left(OutGoingText,8) = "!unwarn " then
    SendCommand OutGoingText
    'get the nickname
    if len(OutGoingText) > 8 then
        nick = mid(OutGoingText,9)
        RemoveWarning nick
    end if   
else
    OutText = OutGoingText
end if
End Function

Sub AddWarning(Nickname)
'check if warning exists
check = GetIniFile("warnings.ini","Warnings",Nickname,0)
if check < 3 then check = check + 1
WriteIniFile "warnings.ini","Warnings",Nickname,check
SendCommand "/say " & WarnColors(check) & "You have now been warned (" & check & "/3) times, " & Nickname
if check => 3 then
   'try and get the host from the IAL
   host = GetIdentifier("$ial(" & Nickname & ").host")
   if host <> "" then
     SendCommand "/mode # +b *!" & host 
   else
     SendCommand "/mode # +b " & Nickname & "!*@*"
   end if
end if
End Sub

Sub ShowWarning(Nickname)
check = GetIniFile("warnings.ini","Warnings",Nickname,0)
SendCommand "/say " & WarnColors(check) & Nickname & " has been warned (" & check & "/3) times"
End Sub

Sub ShowCWarning(Nickname,Channel,ServerNumber)
check = GetIniFile("warnings.ini","Warnings",Nickname,0)
SendCommand "/msg " & Channel & " " & WarnColors(check) & Nickname & " has been warned " & check & " times",ServerNumber
End Sub

Sub RemoveWarning(Nickname)
WriteIniFile "warnings.ini","Warnings",Nickname,""
SendCommand "/say Warnings have been removed for " & Nickname
End Sub
Title: Re: !warn Script
Post by: SniperPro on July 11, 2008, 11:45:14 AM
[14:44] <~SniperPro> !warn sladewill Test
[14:44] <~SniperPro> You have now been warned (1/3) times, sladewill Test
[14:44] <~SniperPro> !warn sladewill Test
[14:44] <~SniperPro> You have now been warned (2/3) times, sladewill Test
[14:44] <~SniperPro> !warn sladewill Test
[14:44] <~SniperPro> You have now been warned (3/3) times, sladewill Test
[14:44] * SniperPro sets mode +b *!$null@* for #test

Thats what it does, I just want it to kick + ban, only the nickname.
Title: Re: !warn Script
Post by: Snerf on July 11, 2008, 01:42:29 PM
How is "sladeWill Test" a nickname?

You only send the nickname, and nicknames do not have spaces in them.

Change the AddWarning sub code, with the code below.

Code: [Select]
Sub AddWarning(Nickname)
'check if warning exists
check = GetIniFile("warnings.ini","Warnings",Nickname,0)
if check < 3 then check = check + 1
WriteIniFile "warnings.ini","Warnings",Nickname,check
SendCommand "/say " & WarnColors(check) & "You have now been warned (" & check & "/3) times, " & Nickname
if check => 3 then
  SendCommand "/mode # +b " & Nickname & "!*@*"
  SendCommand "/kick # " & Nickname   
end if
End Sub
Title: Re: !warn Script
Post by: SniperPro on July 12, 2008, 03:29:03 PM
Thankyou!

It works great

Title: Re: !warn Script
Post by: Rizzo on July 18, 2008, 12:38:59 AM
I would be very keen to use this, but a kick instead of a ban - would someone be able to do this for me please?
Title: Re: !warn Script
Post by: HackBenjamin on July 18, 2008, 03:10:33 AM
Just remove the ban line :)
Title: Re: !warn Script
Post by: Rizzo on July 18, 2008, 12:00:50 PM
Which bit is that? (sorry i wouldn't have posted ifi knew)

'if check => 3 then
   'try and get the host from the IAL
   host = GetIdentifier("$ial(" & Nickname & ").host")
   if host <> "" then
     SendCommand "/mode # +b *!" & host 
   else
     SendCommand "/mode # +b " & Nickname & "!*@*"
   end if
end if'

?
Title: Re: !warn Script
Post by: Snerf on July 18, 2008, 07:54:23 PM
if check => 3 then
  SendCommand "/kick # " & Nickname
end if
Title: Re: !warn Script
Post by: A_K1TTEN on September 28, 2008, 03:43:01 PM
Well the script is working, and i use it all the time, but i get this error...


[18:38]  ->> ERROR:modScriptFunctions:Function:RunScriptValue Error Number:9 : Subscript out of range: '[number: 0]'


It's not affecting anything tho. i was just curious to what it meant. But anyways, GREAT SCRIPT!
Title: Re: !warn Script
Post by: Snerf on September 28, 2008, 04:27:07 PM
Might just be a typo you have in the script.
Title: Re: !warn Script
Post by: A_K1TTEN on September 29, 2008, 03:48:01 PM
Might just be a typo you have in the script.

hrmmm, well i copy and pasted straight from here... but like i said, the script still works, so its fine!
Title: Re: !warn Script
Post by: A_K1TTEN on October 11, 2008, 07:56:59 PM
Would it be possible to get this to work for ANY ops/Half ops, in the channel #ibiteprettyhard-chat ?

I have tried, but nothing happens, the others cant use it, and i don't even get an error?!

It would be greatly appreciated!
Title: Re: !warn Script
Post by: Snerf on October 11, 2008, 08:16:59 PM
Well, the script should work fine, but if I saw correctly in the ONTEXT, it gets the nickname wrong.
I saw nick = mid(OutGoingText,8).. thats all wrong, should be nick = mid(Message,8)
Title: Re: !warn Script
Post by: A_K1TTEN on October 11, 2008, 09:02:14 PM
Well, the script should work fine, but if I saw correctly in the ONTEXT, it gets the nickname wrong.
I saw nick = mid(OutGoingText,8).. thats all wrong, should be nick = mid(Message,8)

Hrrrmmm, that didnt do a thing from the looks of it...