mIRC Homepage
Posted By: spermis rank script - 15/10/07 11:58 AM
Hello i have this rank/top5 script

Code:
[/code]on *:start: {
    hmake TopScores 100
  if ($isfile($scriptdir\topscores.hsh)) { hload TopScores $qt($scriptdir\topscores.hsh) }
}

on *:text:!inc & &:#: {
  if ($nick !isop %1adminchan) { halt }
  hadd TopScores $2 $calc($hget(TopScores,$2) + $3)
  .notice $nick %cvet Added $3 points to $2 %cvet
  hsave TopScores $qt($scriptdir\topscores.hsh)
}
on *:text:!dec & &:#: {
  if ($nick !isop %1adminchan) { halt }
  {
    if ($3 isnum) {
      hadd TopScores $2 $iif($calc($hget(TopScores,$2) - $3) >= 0,$v1,0)
      .notice $nick %cvet Removed $3 point(s) from $2 %cvet
    }
    elseif ($3 == all) {
      hadd TopScores $2 0
      .notice $nick %cvet Removed ALL points from $2 %cvet
    }
    hsave TopScores $qt($scriptdir\topscores.hsh)
  }
}
on *:text:!top5:#: {
  if (%Top5.fld) { return }
  set -u10 %Top5.fld On
  hsave -n TopScores hash.tmp
  filter -ffcuten 2 32 hash.tmp hash.tmp
  var %cnt = 1
  while (%cnt <= 5) {
    var %data = $read(hash.tmp,%cnt)
    msg $chan %cvet $+  $hget(TopScores,$gettok(%data,1,32)).item $+  ranks ir  $+ %cnt $+  no  $+ $hget(TopScores,0).item $+  ar  $+ $gettok(%data,2,32) $+  punktiem  %cvet
    inc %cnt
  }
  .remove hash.tmp
}
alias rank {
  var %w = @ranking, %f = TopScores, %n = $$1, %t = $hget(%f,0).item
  window -hn %w
  clear %w
  while %t {
    aline %w $hget(%f,%t).item $hget(%f,%t).data
    dec %t
  }
  filter -cteuww 2 32 %w %w
  return %cvet $1 $iif($fline(%w,%n *,1), ranks ir  $+ $v1 $+  no  $+ $line(%w,0) $+  ar  $+ $gettok($line(%w,$v1),2,32) $+  punktiem %cvet, nav datubaazee %cvet)
}
alias private {
  var %w = @ranking, %f = TopScores, %n = $$1, %t = $hget(%f,0).item
  window -hn %w
  clear %w
  while %t {
    aline %w $hget(%f,%t).item $hget(%f,%t).data
    dec %t
  }
  filter -cteuww 2 32 %w %w
  return %cvet $1 $iif($fline(%w,%n *,1), tavs rank ir  $+ $v1 $+  no  $+ $line(%w,0) $+  ar  $+ $gettok($line(%w,$v1),2,32) $+  punktiem %cvet, atvaino tu neesi datubaazee %cvet)
}
On *:TEXT:!rank*:#: {
  if ($3 != $null) { notice $chan %cvet Nepareiza komanda. Izmanto !rank vai !rank <nick> %cvet | halt }
  if ($2 == $null) { msg $chan $private($nick) | halt }
  if ($2 != $null) { msg $chan $rank($2) | halt }
}
On *:TEXT:!info*:#: {
  if ($3 != $null) { notice $chan %cvet Nepareiza komanda.  Izmanto !info vai !info <nick> %cvet | halt }
  if ($2 == $null) { msg $chan $private($nick) | halt }
  if ($2 != $null) { msg $chan $rank($2) | halt }
}

so now it saves users like this

nick
43
nick2
21
nick5
53

its all working good, but i need that if someone types !win nick it will add +1 win to nick, so if someone types !info nick it will show

Nick has 43 points and have winned 1 times.
Posted By: Riamus2 Re: rank script - 15/10/07 10:10 PM
/help /hinc

Use that on your hash table.
© mIRC Discussion Forums