mIRC Cash Bot Skeleton

By SimplySys on May 13, 2011

/*
mIRC Game made by Simplicity @ irc.simplicityx.org (me)
I wouldn't suggest modifying this much unless you know your stuff.
Credit to `JoKeR´ @ http://www.hawkee.com/ for the on load/connect
and some smaller parts throughout the script.

This script is slightly buggy. I have no intentions as of now to fix it.
Feel free to modify it if you know what you're doing, as I said above, however I probably
will not offer and support for it.

This is more so a skeleton for a cash bot than anything.
*/

/* 
   mIRC Game made by Simplicity @ irc.simplicityx.org (me)
   I wouldn't suggest modifying this much unless you know your stuff.
   Credit to `JoKeR´ @ http://www.hawkee.com/ for the on load/connect
   and some smaller parts throughout the script.

   This script is slightly buggy. I have no intentions as of now to fix it.
   Feel free to modify it if you know what you're doing, as I said above, however I probably
   will not offer and support for it.

   This is more so a skeleton for a cash bot than anything.
*/

; Cash Game start

on *:LOAD: {
  write cash.txt 0
}
on *:connect: {
  var %x 0
  var %y $read(cash.txt,-1)
  while (%x < %y) {
    hload -si $gettok($read(cash.txt,%y),1,32) cash.ini $gettok($read(cash.txt,%y),1,32)
    inc %x
  }
}

; Aliases for the user commands.

alias C1 { return $+($chr(3),$iif(!$hget($nick,color1),04,$hget($nick,color1)),$1-,$chr(15)) }
alias C2 { return $+($chr(3),$iif(!$hget($nick,color2),14,$hget($nick,color2)),$1-,$chr(15)) }
alias bchk { 
  if ($nick isin %banned) { msg # $C2(You're banned from this game. If this is an error, contact an admin.) | halt }
}
alias aban { if ($1 !isin %banned) { $addtok(%banned,$1,32) | echo -ag Added $1 to the banned list. } }
alias dban { if ($1 isin %banned) { $remtok(%banned,$1.32) | echo -ag Removed $1 from the ban list. } } 

; User commands.

on *:TEXT:.cash:#: {
  bchk
  if (!$hget($nick)) {
    var %gained $r(2,8)
    hmake $nick
    hadd $nick interest 5
    hadd $nick cash 0
    hadd -z $nick timeout $r($r(120,200),$r(600,750))
    hinc $nick cash $calc(%gained * $hget($nick,interest))
    hsave -i $nick cash.ini $hget($nick)
    write -l1 cash.txt $calc($read(cash.txt,-1) + 1)
    write cash.txt $nick $nick
    msg # $C1($nick) $C2($read(actions.txt,n) and gained) $C1($+($,$calc(%gained * $hget($nick,interest)),!)) $&
      $C2(He/she can use this command again in another) $C1($chr(160) $+ $duration($hget($nick,timeout),$r(2,3)))
  }
  elseif ($hget($nick,timeout)) { msg # $C2(You must wait another) $C1($chr(160) $+ $duration($hget($nick,timeout),$r(2,3))) $&
    $C2(before you can use this command again.) }
  else {
    var %gained $r(2,8)
    hadd -z $nick timeout $r($r(120,200),$r(600,750))
    hinc $nick cash $calc(%gained * $hget($nick,interest))
    hsave -i $nick cash.ini $hget($nick)
    msg # $C1($nick) $C2($read(actions.txt) and gained) $C1($+($,$calc(%gained * $hget($nick,interest)),!)) $&
      $C2(He/she can use this command again in another) $C1($chr(160) $+ $duration($hget($nick,timeout),$r(2,3)))
  }
}
on *:TEXT:.setcolors *:#: {
  bchk
  if (!$hget($nick)) && ($2 isnum) && ($2 <= 15) && ($3 isnum) && ($3 <= 15) {
    hmake $nick
    hadd $nick interest 5
    hadd $nick cash 0
    hadd $nick color1 $2
    hadd $nick color2 $3
    hsave -i $nick cash.ini $hget($nick)
    write -l1 cash.txt $calc($read(cash.txt,-1) + 1)
    write cash.txt $nick $nick
    msg # $C2(Your colors have been set to) $C1(this.)
  }
  elseif ($2 isnum) && ($2 <= 15) && ($3 isnum) && ($3 <= 15) {
    bchk
    hadd $nick color1 $2
    hadd $nick color2 $3
    hsave -i $nick cash.ini $hget($nick)
    write -l1 cash.txt $calc($read(cash.txt,-1) + 1)
    write cash.txt $nick $nick
    msg # $C2(Your colors have been set to) $C1(this.)
  }
  else {
    msg # $C2(ERROR:) $C1(You entered invalid parameters.)
    halt
  }
}
on *:TEXT:.stats *:#: {
  bchk
  if ($hget($2)) { var %stat $2 }
  if (!$hget($iif(!%stat,$nick,%stat))) {
    hmake $iif(!%stat,$nick,%stat)
    hadd $iif(!%stat,$nick,%stat) interest 5
    hadd $iif(!%stat,$nick,%stat) cash 0
    hsave -i $iif(!%stat,$nick,%stat) cash.ini $iif(!%stat,$nick,%stat)
    write -l1 cash.txt $calc($read(cash.txt,-1) + 1)
    write cash.txt $iif(!%stat,$nick,%stat) $iif(!%stat,$nick,%stat)
    msg # $C2($iif(!%stat,$nick,%stat) has $C1($chr(160) $+ $+($,$hget($iif(!%stat,$nick,%stat),cash))) $C2(and) $C1($chr(160) $&
      $+ $hget($iif(!%stat,$nick,%stat),interest)) $C2(interest.) $iif($hget($iif(!%stat,$nick,%stat),timeout), $&
      $C2(He/she can use the .cash command again in) $&
      $C1($chr(160) $+ $duration($hget($iif(!%stat,$nick,%stat),timeout),$r(2,3))),$C2(He/she can use the .cash command.))
  }
  else {
    msg # $C2($iif(!%stat,$nick,%stat) has) $C1($chr(160) $+ $+($,$hget($iif(!%stat,$nick,%stat),cash))) $C2(and) $&
      $C1($chr(160) $+ $hget($iif(!%stat,$nick,%stat),interest)) $& 
      $C2(interest.) $iif($hget($iif(!%stat,$nick,%stat),timeout),$C2(He/she can use the .cash command again in) $&
      $C1($chr(160) $+ $duration($hget($iif(!%stat,$nick,%stat),timeout),$r(2,3))),$C2(He/she can use the .cash command.))
  }
}

Comments

Sign in to comment.
irchainscriptz   -  May 15, 2011

have to agree with Napa182 & Jethro why post it if it's got buggs in it. people come on here looking for snippets and some have no clue in coding or fixing a snippet. ( my opinion)

 Respond  
Jethro   -  May 14, 2011

Even though it's harmless to submit a snippet, and you did make the decision in doing so, it's your responsibility to make sure the snippet you've submitted accommodates the expectations of those who come across it. I'm certain no one wants a buggy script to foresee any potential issue that may arise later.

 Respond  
SimplySys   -  May 14, 2011

Jethro_: I wasn't going to submit it initially. There's no real harm in doing so, however.

 Respond  
Jethro   -  May 14, 2011

You sound paradoxical. You're interested in submitting a buggy snippet but are not interested in fixing it.

 Respond  
SimplySys   -  May 14, 2011

napa182: In case somebody else would like the idea and fix it up for themselves. Like I said, though, if anyone shows interest I'd do it.

 Respond  
napa182   -  May 14, 2011

why not fix it up get rid of the bugs an make it nice for the sake of doing so.....
I mean why even post it then if not?

 Respond  
SimplySys   -  May 13, 2011

If I see enough interest in this I will reconsider fixing it up nicely.

 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.