Commands:
Administrators
- .online
.offline
.status <on>/<off> (turns off the .help function)
.next <number> (default 1)
.done <nickname>
.queue
- .help <message>
.remove
.admins
- alias -l ::helpdesk::channel { return #channel }
alias -l ::helpdesk::file { return helpdesk.ini }
alias -l ::helpdesk::nospam::channel { return 10 }
alias -l ::helpdesk::nospam::nick { return 10 }
alias -l ::helpdesk::tag { return [Helpdesk] }
alias -l ::helpdesk::alternatemessage { return Sorry, no one is online at this moment, please send us a mail on mail@mail.org }
Alternatemessage is used when no one is online using the .online/.offline
If you have ideas to new improvements please post them here.
- Code: Select all
;#
;# visit http://sp00fed.org for updates or support.
;# script by Sumsar
;#
;# Setup
alias -l ::helpdesk::channel { return #channel }
alias -l ::helpdesk::file { return helpdesk.ini }
alias -l ::helpdesk::nospam::channel { return 1 }
alias -l ::helpdesk::nospam::nick { return 1 }
alias -l ::helpdesk::tag { return [Helpdesk] }
alias -l ::helpdesk::alternatemessage { return Sorry, no one is online at this moment, please send us a mail on mail@mail.org }
;# Code
on *:TEXT:*:$($::helpdesk::channel):{
set %hostname $gettok($address($nick,5),2,33)
if ($istok($+($chr(43),.,$chr(64)),$left($nick($chan,$nick).pnick,1),46)) {
if ($1 == .online) {
if (!$readini($::helpdesk::file,administrators,online)) { var %online } | else { var %online = $readini($::helpdesk::file,administrators,online) }
if (!$readini($::helpdesk::file,administrators,offline)) { var %offline } | else { var %offline = $readini($::helpdesk::file,administrators,offline) }
if (!$matchtok(%online,%hostname,0,32)) {
writeini -n $::helpdesk::file administrators online $+($readini($::helpdesk::file,administrators,online),$chr(32),%hostname)
if ($matchtok(%offline,%hostname,0,32)) {
var %offline = $remtok($readini($::helpdesk::file,administrators,offline),%hostname,32)
if (%offline) {
writeini -n $::helpdesk::file administrators offline %offline
}
else {
remini $::helpdesk::file administrators offline
}
}
msg $chan Administrator: $nick is now online.
}
else {
notice $nick You are already online
}
}
if ($1 == .offline) {
if (!$readini($::helpdesk::file,administrators,online)) { var %online } | else { var %online = $readini($::helpdesk::file,administrators,online) }
if (!$readini($::helpdesk::file,administrators,offline)) { var %offline } | else { var %offline = $readini($::helpdesk::file,administrators,offline) }
if (!$matchtok(%offline,%hostname,0,32)) {
writeini -n $::helpdesk::file administrators offline $+($readini($::helpdesk::file,administrators,offline),$chr(32),%hostname)
if ($matchtok(%online,%hostname,0,32)) {
var %online = $remtok($readini($::helpdesk::file,administrators,online),%hostname,32)
if (%online) {
writeini -n $::helpdesk::file administrators online %online
}
else {
remini $::helpdesk::file administrators online
}
}
msg $chan Administrator: $nick is now offline
}
else {
notice $nick You are already offline
}
}
if ($1 == .next) {
if ($ini($::helpdesk::file,queue,0) > 0) {
var %num = 1, %x = 1, %output, %remove
if ($2 isnum) { if ($2 > $ini($::helpdesk::file,queue,0)) { var %num = $ini($::helpdesk::file,queue,0) } | else { var %num = $2 } }
while (%x <= %num) {
var %hostname = $ini($::helpdesk::file,queue,%x)
var %message = $readini($::helpdesk::file,queue,%hostname)
var %nickname = $ialchan($+(*!*,%hostname),$chan,1).nick
var %remove = $addtok(%remove,%hostname,32)
set %output %output $+($chr(2),%x,$chr(2),.) %nickname needs help with $+($chr(91),%message,$chr(93))
if (!$readini($::helpdesk::file,next,%hostname)) {
writeini -n $::helpdesk::file next %hostname %message
}
inc %x
}
var %x = $numtok(%remove,32)
while (%x) {
remini $::helpdesk::file queue $gettok(%remove,%x,32)
dec %x
}
msg $chan $::helpdesk::tag $nick is available to help you.
msg $chan $::helpdesk::tag %output
unset %output
}
}
if ($1 == .done) && ($2) {
set %hostname $gettok($address($2,5),2,33)
if ($readini($::helpdesk::file,next,%hostname)) {
remini $::helpdesk::file next %hostname
msg $chan $::helpdesk::tag $2 is done - users in queue $ini($::helpdesk::file,queue,0)
}
}
if ($1 == .queue) {
msg $chan $::helpdesk::tag Users getting help $ini($::helpdesk::file,next,0) - Users in queue $ini($::helpdesk::file,queue,0)
}
if ($1 == .status) {
if ($istok(on.off,$2,46)) {
writeini -n $::helpdesk::file status helpdesk $2
msg $chan $::helpdesk::tag Status changed to $2
}
else {
msg $chan $::helpdesk::tag Status is $readini($::helpdesk::file,status,helpdesk)
}
}
}
if (!%::helpdesk::variable::nospam:: [ $+ [ $wildsite ] ] && !%::helpdesk::variable::nospam:: [ $+ [ $chan ] ]) {
set $+(-u,$::helpdesk::nospam::nick) %::helpdesk::variable::nospam:: [ $+ [ $wildsite ] ] 1
set $+(-u,$::helpdesk::nospam::channel) %::helpdesk::variable::nospam:: [ $+ [ $chan ] ] 1
if ($1 == .help) && ($readini($::helpdesk::file,status,helpdesk) == on) {
if ($numtok($readini($::helpdesk::file,administrators,online),32) > 0) {
if (!$readini($::helpdesk::file,queue,%hostname)) && (!$readini($::helpdesk::file,next,%hostname)) {
if ($2) { var %message = $2- }
writeini -n $::helpdesk::file queue %hostname %message
msg $chan $::helpdesk::tag adding $nick to queue, users in queue $ini($::helpdesk::file,queue,0)
}
}
else {
msg $chan $::helpdesk::tag $::helpdesk::alternatemessage
}
}
if ($1 == .remove) {
set %result $::helpdesk::remove(%hostname,$chan,$nick)
}
if ($1 == .admins) {
var %online, %offline
var %z = $ini($::helpdesk::file,administrators,0)
while (%z) {
var %status = $ini($::helpdesk::file,administrators,%z)
var %hostnames = $readini($::helpdesk::file,administrators,%status)
var %x = $numtok(%hostnames,32)
while (%x) {
set %h $gettok(%hostnames,%x,32)
set %n $ialchan($+(*!*,%h),$chan,1).nick
set $+($chr(37),%status) $eval($+($chr(37),%status),2) %n
dec %x
}
dec %z
}
if ($numtok(%online,32) == 0) {
msg $chan $::helpdesk::tag $::helpdesk::alternatemessage
}
else {
msg $chan $::helpdesk::tag Administrators: Online %online - Offline %offline
}
}
}
}
on *:QUIT: { set %result $::helpdesk::remove($gettok($address($nick,5),2,33)) }
on *:PART:#: { set %result $::helpdesk::remove($gettok($address($nick,5),2,33)) }
on *:KICK:#: { set %result $::helpdesk::remove($gettok($address($knick,5),2,33)) }
alias -l ::helpdesk::remove {
var %hostname = $1, %channel = $2, %nick = $3, %x = 0
if ($readini($::helpdesk::file,queue,%hostname)) {
remini $::helpdesk::file queue %hostname
var %x = 1
}
if ($readini($::helpdesk::file,next,%hostname)) {
remini $::helpdesk::file next %hostname
var %x = 1
}
if (%x == 1) && ($3) {
msg %channel $::helpdesk::tag removing %nick from queue, users in queue $ini($::helpdesk::file,queue,0)
}
}