|
Joined: Oct 2005
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 122 |
just something i was doing on the side, i want to do like a GLOBAL channel kick/ban on a nick
so like say the channels are #channel , #channel2, #channel3 etc
i want it that on right click on $nick i get to scroll down to GLOBAL-BAN - then in that i have two options one is PERMENANT (no timer) the other is TIMED
then as the timed i want a dialog box to come up where if i type
Xs that means X number of seconds Xm that means X number of minutes (60 seconds) Xh that means X number of Hours (3600 seconds) Xd that means X number of Days (86400 seconds) Xw that means X number of Weeks (604800 seconds) Xmo that means X number of months (2419200 seconds)
then i want to be asked "What is The Kick Message" then at the end of the kick message i want it to ALWAYS have GLOBAL-BAN
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
Code is not fully tested, for obvious reasons :tongue: but I'm pretty sure it will work. The code assumes you are going to enter a valid duration. If the last character in duration is not s,m,h,d,w,mo then it will not do anything. 60s bans for 60 seconds 43m bans for 34 minutes 27d bans for 27 days and so on.. menu nicklist {
.Global Ban
..Timed:{
var %rsn = $$?="Duration:"
if (s isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length))
while (%i <= $comchan($$1,0)) {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (m isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 60)
while (%i <= $comchan($$1,0)) {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (h isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 3600)
while (%i <= $comchan($$1,0)) {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (d isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 86400)
while (%i <= $comchan($$1,0)) {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (w isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 604800)
while (%i <= $comchan($$1,0)) {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (mo isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-2)
var %duration = $calc($left(%rsn,%length) * 2419200)
while (%i <= $comchan($$1,0)) {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
}
..Permanent:{
if ($comchan($$1,0) != 0) {
var %i = 1
while (%i <= $comchan($$1,0)) {
ban -k $comchan($$1,%i) $$1 2
inc %i
}
}
}
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
all that is good for what they asked but I wonder if this would be "ok"
menu nicklist,query {
<> KICKS <>
.Minute:nowkick $$1 60 $?="Input kick reason $crlf Or click Cancel"
.Hour:nowkick $$1 3600 $?="Input kick reason $crlf Or click Cancel"
.Day:nowkick $$1 86400 $?="Input kick reason $crlf Or click Cancel"
.Week:nowkick $$1 604800 $?="Input kick reason $crlf Or click Cancel"
.Month:nowkick $$1 2419200 $?="Input kick reason $crlf Or click Cancel"
.Not Limited:nowkick $$1
}
alias nowkick {
var %nickname = $$1
var %BanTime = $2
var %reason = $3-
var %comchan = $comchan(%nickname,0)
var %i = 1
while (%i <= %comchan) {
var %inchan = $comchan(%nickname,%i)
$iif(%BanTime,ban $+(-ku,%BanTime) %inchan %nickname 3 %reason ,ban -k %inchan %nickname 3 %reason )
inc %i
}
}
edit: some fixes and added "reason"
Last edited by MikeChat; 27/10/05 08:27 PM.
|
|
|
|
Joined: Oct 2005
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 122 |
just one thing i noticed, you both used common channels to check, but i cant do this, because i am opped in other channels where the address is not needed to be banned, so i need it only to ban and kick in specific channels
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
It's easy to omit certain channels, just add an if-else statement to the while loops. Find the following line instances (there are 7 of them) ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i Replace each of them with this: if ($comchan($$1,%i) == [color:red]#SomeChannel[/color]) {
inc %i
}
else{
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
To check for multiple channels: if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
}
else{
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
If you're doing this, then it's not really a global ban.
|
|
|
|
Joined: Oct 2005
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 122 |
lol its hard to explain the situation im in, anyways this is the code as it is, jus 2 probs with it atm:
menu nicklist {
.Global Ban
..Timed: {
var %rsn = $$?="Duration:"
car %reason = $$?="Enter Reason:"
if (s isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length))
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #SomeChannel || $comchan($$1,%i) == #SomeChannel2 || $comchan($$1,%i) == #SomeChannel3) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 %reason 2
inc %i
}
}
else if (m isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 60)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #SomeChannel || $comchan($$1,%i) == #SomeChannel2 || $comchan($$1,%i) == #SomeChannel3) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (h isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 3600)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #SomeChannel || $comchan($$1,%i) == #SomeChannel2 || $comchan($$1,%i) == #SomeChannel3) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (d isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 86400)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #SomeChannel || $comchan($$1,%i) == #SomeChannel2 || $comchan($$1,%i) == #SomeChannel3) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
else if (w isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 604800)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #SomeChannel || $comchan($$1,%i) == #SomeChannel2 || $comchan($$1,%i) == #SomeChannel3) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
}
else if (mo isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-2)
var %duration = $calc($left(%rsn,%length) * 2419200)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #SomeChannel || $comchan($$1,%i) == #SomeChannel2 || $comchan($$1,%i) == #SomeChannel3) {
inc %i
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2
inc %i
}
}
}
}
..Permanent: {
if ($comchan($$1,0) != 0) {
var %i = 1
while (%i <= $comchan($$1,0)) {
ban -k $comchan($$1,%i) $$1 2
inc %i
}
}
}
The 2 things: 1) it doesnt show a kick message 2) it still bans in all channels, not jus the ones specified.
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
Ok, well there's a few things wrong with the changes you made. I'll explain them. car %reason = $$?="Enter Reason:" Here you put car instead of var, I assume it's just a typo but nonetheless it will cause the script not to work properly. if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) { I'm not sure you understood entirely when I posted this code previously. The channels listed here are channels that will be skipped, you need to change #SomeChannel, #SomeChannel2, #SomeChannel3 to some channel names that you don't want the person to banned from. So of course if you didn't change this then it will ban everywhere. If you have more than 3 channels you don't want to ban the person on, just add || $comchan($$1,%i) == #SomeChannel4 to the if statement of each loop. Likewise if you have less than 3, you can delete one of them. ban -ku $+ %duration $comchan($$1,%i) $$1 [color:red]%reason 2[/color] The ban command is in the wrong format. You should switch %reason and 2 around, then it will work. Also, because of putting car earlier, %reason would not have done anything even if the code was in the right format. Here is the fixed code. You still need to change #SomeChannel to channels that you want to skip the ban on. Just a general rule of thumb on this forum, if you see text in a code snippet that is colored, it means you need to change it. menu nicklist {
.Global Ban
..Timed: {
var %rsn = $$?="Duration:"
var %reason = $$?="Enter Reason:"
if (s isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length))
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else if (m isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 60)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else if (h isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 3600)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else if (d isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 86400)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else if (w isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 604800)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
}
else if (mo isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-2)
var %duration = $calc($left(%rsn,%length) * 2419200)
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == [color:red]#SomeChannel[/color] || $comchan($$1,%i) == [color:red]#SomeChannel2[/color] || $comchan($$1,%i) == [color:red]#SomeChannel3[/color]) {
inc %i
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
}
}
..Permanent: {
if ($comchan($$1,0) != 0) {
var %i = 1
while (%i <= $comchan($$1,0)) {
ban -k $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
}
|
|
|
|
Joined: Oct 2005
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 122 |
alright sorry bout this but just looking over it - this script isnt going to work, and ill tell you why say im in #channel1,#channel2,#channel3,#channel4,#channel5 then the other nick is in #channel1,#channel2,#channel4 now lets say the EXEMPTED channels are #channel2,#channel5 i want it when i use the ban ti will ban the nick in #channel1 (thecommon) but also #channel3 and #channel4 (which the nick isnt in) therefore the comchan thing doesnt work. Also currently im having a problem with the permanant bit of the script timed works fine (except for the issue arised above) but the permanant lags mirc so i have to quit it.
..Permanent: {
var %reason = $$?="Enter Reason:"
if ($comchan($$1,0) != 0) {
var %i = 1
}
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
else {
ban -k $comchan($$1,%i) $$1 2 %reason 4(GLOBAL TMD BAN)
inc %i
}
}
}
}
}
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
Actually, the script will work exactly as you have asked. The problem is that you don't seem to understand what is going on with the code or you are making uncessary changes which cause it to function improperly. Let me explain what is happening with $comchan [color:green]; This IF statement checks if $comchan is either #criten or #criten-help and if it is, does [/color]
[color:green]; not ban the person from either of these channels. It then continues to increment %i until all [/color]
[color:green]; channels have been checked.[/color]
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
[color:green]; Since the IF statement is taking care of exempt channels, this ELSE statement will ban the [/color]
[color:green]; person from any common channels that are NOT EXEMPT. It then continues to increment %i [/color]
[color:green]; until all channels have been checked.[/color]
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
} The permanent part has many problems from your changes. ..Permanent: {
var %reason = $$?="Enter Reason:"
if ($comchan($$1,0) != 0) {
var %i = 1
} [color:green]; By placing this } here, you are making %i local to the if statement and it therefore cannot[/color]
[color:green]; be passed onto the while loop which causes the infinite loop[/color]
while (%i <= $comchan($$1,0)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
[color:red]}[/color] [color:green]; This } is needed here to close off the IF statement[/color]
[color:green]; I think I may have forgotten to add it previously so sorry if that caused you a problem.[/color]
[color:green];As you noticed there's lots of checking going on so it's very easy to mismatch braces[/color]
else {
ban -k $comchan($$1,%i) $$1 2 %reason 4(GLOBAL TMD BAN)
inc %i
}
}
}
}
} I'm posting the code here again, I've tested it out myself so I can assure you it works exactly as you have asked. I've made sure all braces are lined up and even inserted the exempt channels for you. I also added in a check to see if you are opped on '$comchan' to prevent error messages and added the 'Global Ban' message as part of %reason to shorten the code a bit. You can just copy and paste this code and it will work. menu nicklist {
.Global Ban!
..Timed:{
var %rsn = $$?="Duration:"
var %reason = $$?="Enter Reason:" 4(GLOBAL TMD BAN)
if (s isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length))
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
else if (m isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 60)
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
else if (h isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 3600)
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
else if (d isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 86400)
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
else if (w isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-1)
var %duration = $calc($left(%rsn,%length) * 604800)
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
else if (mo isin $right(%rsn,1)) {
var %i = 1
var %length = $calc($len(%rsn)-2)
var %duration = $calc($left(%rsn,%length) * 2419200)
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -ku $+ %duration $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
}
..Permanent:{
var %reason = $$?="Enter Reason:" 4(GLOBAL TMD BAN)
if ($comchan($$1,0) != 0) {
var %i = 1
while (%i <= $comchan($$1,0)) {
if ($me isop $comchan($$1,%i)) {
if ($comchan($$1,%i) == #criten || $comchan($$1,%i) == #criten-help) {
inc %i
}
else {
ban -k $comchan($$1,%i) $$1 2 %reason
inc %i
}
}
else {
inc %i
}
}
}
}
}
|
|
|
|
Joined: Oct 2005
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 122 |
this ELSE statement will ban the ; person from any common channels that are NOT EXEMPT thats the problem...what if its not a common channel, say im in channel 3 and the other nick ISNOT in channel 3, therefore channel 3 wont be a common channel, but i still need channel 3 to have a ban for the nick.
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
I can't think of any efficient way to do that excep to make individual checks for certain channels. I don't really see the point of doing that, but you can do something like this: if ($nick !ison #NonCommonChannel) { mode #NonCommonChannel +b $address($$1,2) } if ($nick !ison #NonCommonChannel2) { mode #NonCommonChannel2 +b $address($$1,2) } if ($nick !ison #NonCommonChannel3) { mode #NonCommonChannel3 +b $address($$1,2) } Edit: Sorry, I think it is probably better to place the code elsewhere... If you're doing this, put the checks before each occurance of these lines, do not attempt to change anything except the channel names, unless you know what you are doing: if ($comchan($$1,0) != 0) {
var %i = 1 The result should be something like: if ($nick !ison #NonCommonChannel) { mode #NonCommonChannel +b $address($$1,2) }
if ($nick !ison #NonCommonChannel2) { mode #NonCommonChannel2 +b $address($$1,2) }
if ($nick !ison #NonCommonChannel3) { mode #NonCommonChannel3 +b $address($$1,2) }
if ($comchan($$1,0) != 0) {
var %i = 1
Last edited by schaefer31; 29/10/05 11:00 PM.
|
|
|
|
|