This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

need an kick counter for some 3x kick is ban

Old posts that have not been replied to for several years.
Locked
w
willienl
Voice
Posts: 21
Joined: Mon Jan 10, 2005 3:55 am

need an kick counter for some 3x kick is ban

Post by willienl »

Hi there
i have some simple kick counter it count all
i use !test for testing it
set kc 0 is for made var kc
must make if exist of it
but when some one type !test is say kick 1
when some other do it say kick 2
i want this for each user difrent
so i can use this in my bot for count kick`s each user
without an sql or other db inplemention like write to file must be in cache
to reduce mem and cpu use and let it respond faster it is
already use an file db for chekking user host`s and i don't wana check 2
file db`s that go take time to mutch time
how can i do this it is an normal routine for mirc script to use tables
and i se no option to do this in tcl
this way incr var don't work good it count global and not kick`s per nick

Code: Select all

set kc 0
bind pub - "!test" pub:kctest
proc pub:kctest {nick uhost hand channel arg} {
	if {$nick == "3" } {
	putquick "PRIVMSG $channel : $nick this is kick $kc banned now"
	set kc 0 
	} else {
	incr kc
	putquick "PRIVMSG $channel : $nick this is kick $nick "
	}
 return 0
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

Code: Select all

bind pub - "!test" pub:kctest 
proc pub:kctest {nick uhost hand channel arg} { 
  global kc
  if ![info exists kc([set n [string tolower $nick]])] { 
    set kc($n) 1
    putquick "PRIVMSG $channel :$nick this is kick $kc($n)"
  } elseif { $kc($n) == 2 } {
      incr kc($n)
      putquick "PRIVMSG $channel :$nick this is kick $kc($n) banned now" 
      unset kc($n)
  } else { 
      incr kc($n) 
      putquick "PRIVMSG $channel :$nick this is kick $kc($n)"
  } 
  return 0 
}
should work (didnt test)
photon?
w
willienl
Voice
Posts: 21
Joined: Mon Jan 10, 2005 3:55 am

Post by willienl »

Thnx a lot i go test now looks ok
i whas try to do in in an temp array
but din't work yet do some wrong in the array function and not shure
if it do how i like :)
****EDIT******
thnx thnx thnx :D
it works great
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yep, but if you restart your bot, the counter will start from 0 again. If you want to avoid that save the integer into a file (write it) then read it everytime from the file you have saved it in.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
w
willienl
Voice
Posts: 21
Joined: Mon Jan 10, 2005 3:55 am

Post by willienl »

thats no problem
it must reset the counter for an user afther 10 min
and not use mutch resources
only fix an auto reset timer and done
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

awyeah : an array won't reset to 0 upon a restart. :P
Once the game is over, the king and the pawn go back in the same box.
w
willienl
Voice
Posts: 21
Joined: Mon Jan 10, 2005 3:55 am

Post by willienl »

i know it do not auto reset
it reset when eggdrop reset`s but the kick counter data
is only for temp use
other question about this script

i have try to make the counter reset afther 1 min (for debug 1 min when work 10min)
with the timer command but the problem is when it triggers there is an nick name
so $n is not empty
afther 10 min is an difrent story how to reset the counter for that one set xx time ago not all counters

Code: Select all

bind pub - "!test" pub:kctest 
proc pub:kctest {nick uhost hand channel arg} { 
  global kc 
  if ![info exists kc([set n [string tolower $nick]])] { 
   set kc($n) 1
    putquick "PRIVMSG $channel :$nick  test $kc($n) "
    timer 1 { unset kc($n) }
  } elseif { $kc($n) == 2 } { 
   incr kc($n) 
    putquick "PRIVMSG $channel :$nick 3 test $kc($n) "
    unset kc($n) 
  } else { 
   incr kc($n) 
    putquick "PRIVMSG $channel :$nick  test $kc($n) "
    timer 1 { unset kc($n) }
  } 
  return 0 
} 
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

Code: Select all

proc checkkc n { 
  if {[info exists ::kc($n)]} { 
    unset ::kc($n)
  } { putlog "dontexist: shouldnt happen" }
}
proc checkt { n w } {
  foreach t [timers] {
    if {[string equal [lindex [lindex $t 1] 0] "checkkc"] && [string equal [lindex [lindex $t 1] 1] $n]} { 
      killtimer [lindex $t 2]
      if {$w == "restart"} { timer 10 [list checkkc $n] }
    }
  }
}
bind pub - "!test" pub:kctest 
proc pub:kctest {nick uhost hand channel arg} { 
  global kc
  if ![info exists kc([set n [string tolower $nick]])] { 
    set kc($n) 1
    timer 10 [list checkkc $n]
    putquick "PRIVMSG $channel :$nick this is kick $kc($n)"
  } elseif { $kc($n) == 2 } {
      incr kc($n)
      putquick "PRIVMSG $channel :$nick this is kick $kc($n) banned now" 
      checkt $n kill
      unset kc($n)
  } else { 
      checkt $n restart
      incr kc($n) 
      putquick "PRIVMSG $channel :$nick this is kick $kc($n)"
  } 
  return 0 
}
maybe i misunderstood you, but anyhow, this is what the above does:

starts 10min unset timer when first triggered
restarts 10min unset timer on 2nd trigger
kills timer and unsets kc($n) on 3rd trigger.
photon?
w
willienl
Voice
Posts: 21
Joined: Mon Jan 10, 2005 3:55 am

Post by willienl »

first trigger start timer unset afther 10min
when triggers again reset timer to 10min again
when trigger 3th time unset timer
thats ok i go test now
But the biggy problem is as simple
what shuld be reset ?
if nick1 get kick't 2 times
and nick 2 get kickts 3 times it don't forget nick1 is still kick't 2 times
that ok just how i want it
10 minutes later is the trigger kc($n)
kc(lastkicknick) or do i misunderstand ?
Locked