User Statistics v1.5

By Pepsi_Man0077 on Mar 31, 2008

This is a script i have been working on on and off. Its meant or a bot, but it can be used by yourself it you dont with to use it, otherwise it will need an on *:INPUT: portion to the script

It basically takes basic statistics on users. To see the info you type !info

also takes info in the channel

!info

Tell me what you think, and if you think i should expand to it ex: ops, deops, and such

please let me know if you find mistakes

PePSiMaN

;===================
;= User Stats v1.5 =
;===================

alias stats.save {
  hsave Stats Stats.hsh
  timersave 0 120 stats.save
}

on *:START: {
  hmake Stats 9999
  stats.save
  hload Stats Stats.hsh
}

;===========
;== Joins ==
;===========

on *:JOIN:*: {

  ;=========
  ;= Start =
  ;=========

  if ($hget(Stats,$nick $+ .TextCount) = $null) { hadd -m Stats $nick $+ .TextCount 0 }
  if ($hget(Stats,$nick $+ .ChrCount) = $null) { hadd -m Stats $nick $+ .ChrCount 0 }
  if ($hget(Stats,$nick $+ .BanCount) = $null) { hadd -m Stats $nick $+ .BanCount 0 }
  if ($hget(Stats,$nick $+ .PartCount) = $null) { hadd -m Stats $nick $+ .PartCount 0 }
  if ($hget(Stats,$nick $+ .BannedCount) = $null) { hadd -m Stats $nick $+ .BannedCount 0 }
  if ($hget(Stats,$nick $+ .KickCount) = $null) { hadd -m Stats $nick $+ .KickCount 0 }
  if ($hget(Stats,$nick $+ .KickedCount) = $null) { hadd -m Stats $nick $+ .KickedCount 0 }
  if ($hget(Stats,$chan $+ .BanCount) = $null) { hadd -m Stats $chan $+ .BanCount 0 }
  if ($hget(Stats,$chan $+ .KickCount) = $null) { hadd -m Stats $chan $+ .KickCount 0 }
  if ($hget(Stats,$chan $+ .PartCount) = $null) { hadd -m Stats $chan $+ .PartCount 0 }

  ;========
  ;= Nick =
  ;========

  if ($hget(Stats,$nick $+ .JoinCount) = $null) { notice $nick 7Hello there $nick, I will be taking random statistics on you. If you wish to see these stats at anytime simply type !info $nick }
  if ($hget(Stats,$nick $+ .JoinCount) = $null) { hadd -m Stats $nick $+ .Start $fulldate | hadd -m Stats $nick $+ .JoinCount 1 }
  if ($hget(Stats,$nick $+ .JoinCount) != $null) { hadd -m Stats $nick $+ .JoinCount $calc($hget(Stats,$nick $+ .JoinCount) + 1) }

  ;===========
  ;= Channel =
  ;===========

  if ($hget(Stats,$chan $+ .JoinCount) = $null) { 
    hadd -m Stats $chan $+ .Start $fulldate 
    hadd -m Stats $chan $+ .JoinCount 1 
  }
  if ($hget(Stats,$chan $+ .JoinCount) != $null) { hadd -m Stats $chan $+ .JoinCount $calc($hget(Stats,$chan $+ .JoinCount) + 1) }
}

;===========
;== Parts ==
;===========

on *:PART:*: {

  ;========
  ;= Nick =
  ;========

  if ($hget(Stats,$nick $+ .PartCount) = $null) { hadd -m Stats $nick $+ .PartCount 1 }
  if ($hget(Stats,$nick $+ .PartCount) != $null) { hadd -m Stats $nick $+ .PartCount $calc($hget(Stats,$nick $+ .PartCount) + 1) }

  ;===========
  ;= Channel =
  ;===========

  if ($hget(Stats,$chan $+ .PartCount) = $null) { hadd -m Stats $nick $+ .PartCount 1 }
  if ($hget(Stats,$chan $+ .PartCount) != $null) { hadd -m Stats $chan $+ .PartCount $calc($hget(Stats,$chan $+ .PartCount) + 1) }
}

;========
;= Bans =
;========

on *:BAN:#: {

  ;========
  ;= Nick =
  ;========

  if ($hget(Stats,$nick $+ .BanCount) = $null) { hadd -m Stats $nick $+ .BanCount 1 }
  if ($hget(Stats,$nick $+ .BanCount) != $null) { hadd -m Stats $nick $+ .BanCount $calc($hget(Stats,$nick $+ .BanCount) + 1) }
  if ($hget(Stats,$bnick $+ .BannedCount) = $null) { hadd -m Stats $bnick $+ .BannedCount 1 }
  if ($hget(Stats,$bnick $+ .BannedCount) != $null) { hadd -m Stats $bnick $+ .BannedCount $calc($hget(Stats,$bnick $+ .BannedCount) + 1) }

  ;===========
  ;= Channel =
  ;===========

  if ($hget(Stats,$chan $+ .BanCount) = $null) { hadd -m Stats $chan $+ .BanCount 1 }
  if ($hget(Stats,$chan $+ .BanCount) != $null) { hadd -m Stats $chan $+ .BanCount $calc($hget(Stats,$chan $+ .BanCount) + 1) }
}

;=========
;= Kicks =
;=========

on *:KICK:#: {

  ;========
  ;= Nick =
  ;========

  if ($hget(Stats,$nick $+ .KickCount) = $null) { hadd -m Stats $nick $+ .KickCount 1 }
  if ($hget(Stats,$nick $+ .KickCount) != $null) { hadd -m Stats $nick $+ .KickCount $calc($hget(Stats,$nick $+ .KickCount) + 1) }
  if ($hget(Stats,$knick $+ .KickedCount) = $null) { hadd -m Stats $knick $+ .KickedCount 1 }
  if ($hget(Stats,$knick $+ .KickedCount) != $null) { hadd -m Stats $knick $+ .KickedCount $calc($hget(Stats,$knick $+ .KickedCount) + 1) }

  ;===========
  ;= Channel =
  ;===========

  if ($hget(Stats,$chan $+ .BanCount) = $null) { hadd -m Stats $chan $+ .BanCount 1 }
  if ($hget(Stats,$chan $+ .BanCount) != $null) { hadd -m Stats $chan $+ .BanCount $calc($hget(Stats,$chan $+ .BanCount) + 1) }
}

;========
;= Text =
;========

on *:TEXT:*:*: {

  ;=================
  ;= Channel Stats =
  ;=================

  if ($hget(Stats,$chan $+ .TextCount) = $null) { hadd -m Stats $chan $+ .TextCount 1 }
  if ($hget(Stats,$chan $+ .TextCount) != $null) { hadd -m Stats $chan $+ .TextCount $calc($hget(Stats,$chan $+ .TextCount) + 1) }
  if ($hget(Stats,$chan $+ .ChrCount) = $null) { hadd -m Stats $chan $+ .ChrCount $len($1-) }
  if ($hget(Stats,$chan $+ .ChrCount) != $null) { hadd -m Stats $chan $+ .ChrCount $calc($hget(Stats,$chan $+ .ChrCount) + $len($1-)) }

  ;==============
  ;= User Stats =
  ;==============

  if ($hget(Stats,$nick $+ .TextCount) = $null) { hadd -m Stats $nick $+ .TextCount 1 }
  if ($hget(Stats,$nick $+ .TextCount) != $null) { hadd -m Stats $nick $+ .TextCount $calc($hget(Stats,$nick $+ .TextCount) + 1) }
  if ($hget(Stats,$nick $+ .ChrCount) = $null) { hadd -m Stats $nick $+ .ChrCount $len($1-) }
  if ($hget(Stats,$nick $+ .ChrCount) != $null) { hadd -m Stats $nick $+ .ChrCount $calc($hget(Stats,$nick $+ .ChrCount) + $len($1-)) }

  ;=========
  ;= !info =
  ;=========

  if ($1 = !info) {
    if ($hget(Stats,$2 $+ .JoinCount) = $null) && ($2 !ison $chan) { 
      msg $chan 3S7orry 3 $+ $left($nick,1) $+ 7 $+ $right($nick,$calc($len($nick) - 1)) $+ , 3b7ut 3 $+ $left($2,1) $+ 7 $+ $right($2,$calc($len($2) - 1)) 3w7as 3n7ot 3f7ount 3i7n 3t7he 3d7atabase 
      halt
    } 
    if ($hget(Stats,$2 $+ .JoinCount) = $null) && ($2 ison $chan) { 
      msg $chan 7I have not started taking stats for $2 yet, i will as soon as they re-join. 
      halt
    }

    ;=================
    ;= Channel Stats =
    ;=================

    if (# isin $2) {
      msg $chan 15[4Stats for  $+ $2 $+ 15]
      msg $chan 15[7Lines of Text:  $+ $hget(Stats,$2 $+ .TextCount) $+ 15][7Characters said:  $+ $hget(Stats,$2 $+ .ChrCount) $+ 15]
      msg $chan 15[7Join Count:  $+ $hget(Stats,$2 $+ .JoinCount) $+ 15][7Part Count:  $+ $hget(Stats,$2 $+ .PartCount) $+ 15]
      msg $chan 15[7Ban Count:  $+ $hget(Stats,$2 $+ .BanCount) $+ 15][7Kick Count:  $+ $hget(Stats,$2 $+ .KickCount) $+ 15]
      msg $chan 15[7I have been taking stats for $2 since:  $+ $hget(Stats,$2 $+ .Start) $+ 15]
    }

    ;==============
    ;= User Stats =
    ;==============

    if (# !isin $2) {
      msg $chan 15[3Stats for  $+ $2 $+ 15]
      msg $chan 15[7Lines of Text:  $+ $hget(Stats,$2 $+ .TextCount) $+ 15][7Characters said:  $+ $hget(Stats,$2 $+ .ChrCount) $+ 15]
      msg $chan 15[7Join Count:  $+ $hget(Stats,$2 $+ .JoinCount) $+ 15][7Part Count:  $+ $hget(Stats,$2 $+ .PartCount) $+ 15]
      msg $chan 15[7Bans:  $+ $hget(Stats,$2 $+ .BanCount) $+ 15][7Kicks:  $+ $hget(Stats,$2 $+ .KickCount) $+ 15]
      msg $chan 15[7Times Banned:  $+ $hget(Stats,$2 $+ .BannedCount) $+ 15][7Times Kicked:  $+ $hget(Stats,$2 $+ .KickedCount) $+ 15]
      msg $chan 15[7I have been taking stats for $2 since:  $+ $hget(Stats,$2 $+ .Start) $+ 15]
    } 
  }
}

Comments

Sign in to comment.
HoNdAx707   -  Apr 01, 2008

i learn something new ;p

 Respond  
xDaeMoN   -  Apr 01, 2008

@ jonesy44, you have it the other way around.

 Respond  
Jonesy44   -  Apr 01, 2008

\"if (!var) {\" is if the variable is non-existent,
\"if (var == $null) {\" is if the variable is non-existent or equal to 0

 Respond  
Noutrious   -  Apr 01, 2008

HoNdAx707, not always.. if there could be 0 as the $blah(blah,blah), it will not work with !$blah(blah,blah), but will with $blah(blah,blah) = $null

 Respond  
HoNdAx707   -  Apr 01, 2008

i belive instead of all the if ($blah(blah,blah) = $null) {
you can do if (!$blah(blah,blah)) {

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.