I'm new at TCL, could someone script this for me, hopefully ill just be able to use this as an example and go from there. I have a channel called #invitescrim:s and I want all the people with +o and +v to be able to kick/ban people with no access by typing .noti namehere. So i could type .noti dumbo and it would kick/ban dumbo (he cant be a peon or op). Thanks.
bair wrote:I'm new at TCL, could someone script this for me, hopefully ill just be able to use this as an example and go from there. I have a channel called #invitescrim:s and I want all the people with +o and +v to be able to kick/ban people with no access by typing .noti namehere. So i could type .noti dumbo and it would kick/ban dumbo (he cant be a peon or op). Thanks.
If i understood what you were asking correctly this should do the trick.
bind pub - .noti pub_kick
proc pub_kick {nick uhost hand chan args} {
global botnick
set args [lindex $args 0]
set lamer [lindex $args 0]
if {[!isop $nick] || [!isvoice $nick]} {
putserv "PRIVMSG $chan :You dont have access to this command."
return 0
}
if {[botisop $chan]} {
if {[string length $args] > 0} {
if {($lamer == $botnick)} {
putserv "PRIVMSG $chan :Why the hell would i want to kick myself?"
return 0
}
if {[string length [lindex $args 1]] == 0} {
set reason "kicked and banned by $nick"
} else {
set reason [lrange $args 1 end]
}
if {[onchan $lamer $chan]} {
newchanban $chan *!*@[lindex [split [getchanhost $lamer $chan] @] 1] $nick $reason 120
utimer 5 [putkick $chan $lamer $reason]
} else {
puthelp "NOTICE $nick :no such nick on channel!"
}
} else {
puthelp "NOTICE $nick :usage .noti <nick> <reason> - kicks and bans a nick "
}
} else {
puthelp "NOTICE $nick :i dont have ops!"
}
}
Hope this helps
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
bind pub ov .noti foo
proc foo {n u h c t} {
if {[nick2hand $t $c] == "*"} {
newchanban $c [maskhost $t![getchanhost $t $c]] $n out
putkick $c $t out
}
}
Demond i intentionally wrote it that way as the guy is 'NEW' to TCL.
You can follow my script quite easily and work out what each part is doing.
Your script is too advanced for beginners although they do the same job. I was just trying to give the guy a nice easy start.
If i saw {n u h c t} for the first time I wouldn't have a clue what they meant.
also if you read what he said he wanted people with no access which i took to mean they weren't added to the bots userlist so binding 'ov' wouldn't work
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
thanks, when i said no access i simply meant they were an op or a voice in the channel (has nothing to do with the eggdrops userlist, just chanserv's), all the ops and voiced people can kick the nonopped and nonvoiced people by doing .noti name, is that how these are set up?
Last edited by bair on Tue Dec 28, 2004 7:28 pm, edited 1 time in total.
have you added the ops and voiced people into the bots userlist?
The script i wrote should work regardless of if they are added to the bot or not it just works on if they have ops or voice in channel. My script also checks to see if the person being kicked and banned is in the channel and that the user has actually typed a nick into the command line and if not they are shown howto use the command.
demonds script is just a simple kickban script as was intended but no checks at all and no help it will just execute that script if the person is there or not. but demonds script does require that the users of the command are added to the bots userlist.
They both will have the same result the offender will be removed from the channel.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
bair wrote:i dont want to have to add anyone to the bot's userlist, ops and voices can use it at default
Thats what i thought you meant from your original posting.
Its upto you what you use as its your bot we just offer help and let you decide what you want todo with that help.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
lindex'ing and splitting several times instead of just once is hardly smaller & faster, don't you think? besides, the proc execution time in this case is totally irrelevant - as your return 0's
if {[isop $nick $chan] || [isvoice $nick $chan]} {
if {![isop $victim $chan] && ![isvoice $victim $chan]} {
to this:
if {[isop $nick $chan] || [isvoice $nick $chan] && ![isop [lindex [split $text] 0] $chan] && ![isvoice [lindex [split $text] 0] $chan]} {
Two if statements can be put together into one
Obviously lindexing it at first is for easier reading ability, and as for the return 0, its same as like halt. Well it is not compulsory and executes after everything has executed so I wouldn't count it to delay anything. It's just if you want to use it or not, doesn't make a big difference within this proc.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================
return 0 same as halt? what are you talking about?? we're not dealing with mIRC scripting here...
the return code from [bind pub] proc is only relevant if it's 1, which means log the command; you are confused with other type binds (ctcp, raw, etc.) which force the bot to discontinue further processing of that event if return 1 (not 0!); I suppose you actually meant that "halt", which has nothing to do with [bind pub] proc