Hi,

Code:

on *:TEXT:!getfarm:#:{
  if $hget(darkhash,$nick) { showfarms $nick }
  else { msg $nick You dont exist, Please register by downloading Tjirps farm script }
}
 [color:red]  [/color] 
alias showfarms {
  .remove stats.tmp
  var %number = $gettok($hget(darkhash,$$1),2,32), %nick = $1
  var %a = 1
  while $hget(darkhash,%a).data {
    tokenize 32 $v1
    if $2 < %number { write stats.tmp $hget(darkhash,%a).item is level $1 with Defense $2 }
    inc %a
  }
  filter -fftc 7 32 stats.tmp stats.tmp *
  if !$filtered { .msg %nick Im sorry, no farms found for you. }
  else { .play %nick stats.tmp 1500 }
}

That will do what you want it to do. There are some remarks:

[*] Using people's address to identify them is a bad idea these days, because most will probably have a dynamic address. That means their address will change often, which means the bot won't recognize them anymore. Therefore, I've used the actual nicknames as hash table items. You are of course to do as you please.

[*] After a while your user database will grow, and the ordinary "msg $nick" will be lagging for you and the receiver, and will eventually get you flooded off the server. Therefore I've changed the way of displaying from msging to use the command /play. It will play a text file to a user with a chosen delay. Right now I put the delay at 1500 ms. Change it at will.

[*] Right now I'm writing all the nicks with a score lower than the requester, by using the regular /write command. This works fine, until your userbase will become very big. Then /write will be slower, and can perhaps be replaced with file handling commands like /fwrite etc. This isn't really a problem, but a side-note.

[*] Scores are compared on their defense, like it was in the previous posts (2nd category).

Good luck with your bot,

Greets

Last edited by FiberOPtics; 16/09/04 10:53 PM.

Gone.