This is a simple age limit.
/age activates|deactivates the script
/agelimit sets the channel and age limit
updated the regex so it no longer kicks is a person says their age is 140 and the limit is 14
alias age { if (!%age1) { .enable #age | set %age1 1 | echo -a age limit on. }
else { .disable #age | unset %age1 | echo -a age limit off. }
}
#age off
on *:JOIN:%agechan: { if ($readini(age,$chan,$+($nick,num)) isnum) { msg $chan Welcome $nick $+ , $readini(age,$chan,$nick) } | else { if ($nick != $me) {
if ($readini(age,$chan,$address($nick,2)) !isnum) { set %chan $chan | set %nick $nick | msg $chan Welcome, $+($nick,$chr(44)) to $+(%agechan,.) please say your age or I cannot allow you to stay. [double digit numbers only please] (you have 60 seconds to state your age) [automated msg] | $remove(.timer $nick,$chr(32)) 1 60 kick %chan %nick didnt state age quick enough, rejoin and retry | $remove(.timer $nick 30,$chr(32)) 1 30 msg %chan You have only 30 seconds left to say how old you are before this bot kicks you out. }
if ($readini(age,$chan,$address($nick,2)) isnum) { if ($readini(age,$chan,$address($nick,2)) >= %agelimit) { msg $chan $+($nick,$chr(44)) my records say you are $+($readini(age,$chan,$address($nick,2)),.) Welcome. } | if ($readini(age,$chan,$address($nick,2)) < %agelimit) { kick $chan $nick sorry, still too young. you have $calc( %agelimit - $readini(age,$chan,$address($nick,2)) ) years to go. come back then. | mode $chan +b $address($nick,2) }
} }
} }
menu nicklist {
..Age limit
.Except user: { writeini age $chan $1 $?"why are they excepted from the age limit?" | writeini age $chan $+($1,num) 1 | echo -a User Excepted: $readini(age,$chan,$1) }
.Delete user: { remini age $chan $1 | remini age $chan $+($1,num) } }
on $*:TEXT:/([0-9]*)/giS:%agechan: if ($readini(age,$chan,$address($nick,2)) !isnum) { if ($regml(1) >= %agelimit) { writeini age $chan $address($nick,2) $regml(1) | $remove(timer $nick,$chr(32)) off | $remove(timer $nick 30,$chr(32)) off | msg $chan thank you, i will remember that, :) | unset %chan | unset %nick } | if ($regml(1) < %agelimit) { writeini age $chan $address($nick,2) $regml(1) | kick $chan $nick sorry, too young. | $remove(timer $nick,$chr(32)) off | $remove(timer $nick 30,$chr(32)) off } }
on *:TEXT:!erase:%agechan: if ($readini(age,$chan,$address($nick,2)) isnum) { if ($readini(age,$chan,$address($nick,2)) >= %agelimit) { writeini age $chan $address($nick,2) moo | msg $chan record successfully erased. } }
#age end
alias agelimit { set %agechan $?"What channel has the age limit?" | set %agelimit $?"What is the age limit?" | .enable #age | set %age1 1 }
Some of that sentence is incorrect. On join, it sets a timer using the $+(timer,$nick). this makes it impossible for the wrong person to be kicked. and on a rejoin after initial too young kick, the code up ther bans the user. i tested it all very well, i have used this script for quite a while and i have made it better out of neccesity. The only problem i see is that people that use wirc cannot use it.
quite a few errors here, when someone states their age as something below the age limit, and they join again they don't get kicked, the person who's just been asked to state their age does, also, you should add a manual way to remove users from the list, just incase they state their age as !9 when they meant to do say !19.
you could do somthing like this and have them enter their year of their birth ex: !1999
the only problem is anyone can lie about their age...
on !@*:join:#:{
if (!$readini(agecheck.ini,AgeCheck,$nick)) {
.notice $nick Please type in ur Year of Birth ex: !1999 You have 15 seconds to do so before you are banned from this room
.notice $nick You will only be asked to do this once if you pass
.timer.age.check 1 15 ban -k # $nick 2 Failed To Give Year Of Birth
}
}
on $@*:text:/^!(\d{4})$/S:#: {
var %age = $calc($date(yyyy) - $regml(1))
if (%age isnum 18-60) {
msg # Oh Ur %age Years Old.. Well Then You Can Stay.
.timer.age.check off
writeini agecheck.ini AgeCheck $nick $address($nick,2)
}
else { ban -k # $nick 2 $iif(%age > 60,TOO OLD,TOO YOUNG) | .timer.age.check off }
}