Bank Script

By airsfotglock on Aug 07, 2010

Ok this is a script i requested and i added lots of things to it. To set it up type /setup_slots. The commands are,
Owner cmds:
!addadmin
!deladmin
!ajoin
!apart
Admin cmds:
!setcash
!setbank
!makesay
User cmds:
!stats
!withdraw
!deposit
!slots
!statsof
!mug
|| END ||
ok well modify it all you want idk at all. Just say Aucun50 made the original airsoftglock added fetures to it and you(the user) editted it. Well have fun with it. I recomend you use $read and $write ini not $gettok read/write ini are better. thank you bai

on $*:text:/^[!@`~](addadmin|deladmin|ajoin|apart|)/Si:#: { 
  if ($nick == $gettok($readini(slots.ini,Admin,Owner),1,32) && $istok($readini(slots.ini,Ident,Users),$nick,32)) { 
    if ($regml(1) == addadmin && $2) { 
      if ($istok($readini(slots.ini,Users,Users),$2,32) && $istok($readini(slots.ini,Admin,Users),$2,32) == $false) { 
        $iif($readini(slots.ini,Admin,Users),writeini slots.ini Admin Users $readini(slots.ini,Admin,Users) $2,writeini slots.ini Admin Users $2) 
        msg $chan Admin $2 added. 
      } 
      else { msg $chan $2 is already in the Admin list or isn't registered. } 
    } 
    else if ($regml(1) == deladmin && $2) { 
      if ($istok($readini(slots.ini,Admin,Users),$2,32)) { 
        $iif($numtok($readini(slots.ini,Admin,Users),32) > 1,writeini slots.ini Admin Users $remove($readini(slots.ini,Admin,Users),$2),remini slots.ini Admin Users) 
        msg $chan Deleted Admin $2 $+ . 
      } 
      else { msg $chan $2 isn't on the Admin list. } 
    } 
    else if ($regml(1) == ajoin) { /join $2 } 
    else if ($regml(1) == apart) { /part $2 }  
  } 
}

on $*:text:/^[!@`~](setcash|setbank|makesay)/Si:#: { 
  if ($istok($readini(slots.ini,Admin,Users),$nick,32) && $istok($readini(slots.ini,Ident,Users),$nick,32)) { 
    if ($regml(1) == setcash && $2 && $3) { 
      if ($istok($readini(slots.ini,Users,Users),$2,32)) { 
        writeini slots.ini Stats $2 $replace($readini(slots.ini,Stats,$2),$gettok($readini(slots.ini,Stats,$2),1,32),$3) 
        msg $chan Setting $2 $+ 's cash to $3 $+ . 
      } 
      else { msg $chan No record of $2 $+ . } 
    } 
    else if ($regml(1) == setbank && $2 && $3) { 
      if ($istok($readini(slots.ini,Users,Users),$2,32)) { 
        writeini slots.ini Stats $2 $replace($readini(slots.ini,Stats,$2),$gettok($readini(slots.ini,Stats,$2),2,32),$3) 
        msg $chan Setting $2 $+ 's bank to $3 $+ . 
      } 
      else { msg $chan No record of $2 $+ . } 
    } 
    else if ($regml(1) == makesay) { msg $chan $2- } 
  } 
} 

on $*:text:/^[!@`~](stats|withdraw|deposit|slots|statsof|mug)/Si:#: { 
  if ($istok($readini(slots.ini,Ident,Users),$nick,32)) { 
    if ($regml(1) == stats) { 
      msg $chan 9--------12 $nick 's info4--------
      msg $chan 6Hand Cash: $gettok($readini(slots.ini,Stats,$nick),1,32) $+ . 
      msg $chan 3Bank Cash: $gettok($readini(slots.ini,Stats,$nick),2,32) 
      msg $chan 4Wins: $gettok($readini(slots.ini,Stats,$nick),3,32) losses: $gettok($readini(slots.ini,Stats,$nick),4,32)
      if ($istok($readini(slots.ini,Admin,Users),$nick,32) && $istok($readini(slots.ini,Ident,Users),$nick,32)) { msg $chan 13- $nick is one of my admins. - }
      if ($nick == $gettok($readini(slots.ini,Admin,Owner),1,32) && $istok($readini(slots.ini,Ident,Users),$nick,32)) { msg $chan 2- $nick is my owner. - }
      msg $chan 9--------12 end of stats4--------
    }
    else if ($regml(1) == withdraw && $2) { 
      if ($2 > $gettok($readini(slots.ini,Stats,$nick),2,32)) { 
        msg $chan You don't have that much in your bank 
      } 
      else { 
        writeini slots.ini Stats $nick $calc($gettok($readini(slots.ini,Stats,$nick),1,32) + $2) $calc($gettok($readini(slots.ini,Stats,$nick),2,32) - $2) $gettok($readini(slots.ini,Stats,$nick),3-4,32)) 
        msg $chan You withdrew $2 from your bank. 
      } 
    } 
    else if ($regml(1) == deposit && $2) { 
      if ($2 > $gettok($readini(slots.ini,Stats,$nick),1,32)) { 
        msg $chan You don't have that much 
      } 
      else { 
        writeini slots.ini Stats $nick $calc($gettok($readini(slots.ini,Stats,$nick),1,32) - $2) $calc($gettok($readini(slots.ini,Stats,$nick),2,32) + $2) $gettok($readini(slots.ini,Stats,$nick),3-4,32)) 
        msg $chan You deposited $2 into your bank. 
      } 
    } 
    else if ($regml(1) == statsof) { 
      $iif($istok($readini(slots.ini,Users,Users),$2,32),msg $chan Stats for $2 are $gettok($readini(slots.ini,Stats,$2),3,32) Won and $gettok($readini(slots.ini,Stats,$2),4,32) Lost.,msg $chan No Stats recorded for $2) 
    } 
    else if ($regml(1) == slots && $2 isnum) { 
      if ($gettok($readini(slots.ini,Stats,$nick),1,32) >= $2) { 
        var %r1 = $r(1,2), %r2 = $r(1,2), %r3 = $r(1,2) 
        if (%r1 == %r2 && %r2 == %r3) { 
          writeini slots.ini Stats $nick $calc($gettok($readini(slots.ini,Stats,$nick),1,32) + $calc($2 * 2)) $gettok($readini(slots.ini,Stats,$nick),2,32) $calc($gettok($readini(slots.ini,Stats,$nick),3,32) + 1) $gettok($readini(slots.ini,Stats,$nick),4,32) 
          msg $chan 7%%%%%%%%%%%%%%%%%
          msg $chan Congratz you won $+($chr(36),$calc($2 * 2)) : $+ $chr(41) 
        } 
        else { 
          writeini slots.ini Stats $nick $calc($gettok($readini(slots.ini,Stats,$nick),1,32) - $2) $gettok($readini(slots.ini,Stats,$nick),2,32) $gettok($readini(slots.ini,Stats,$nick),3,32) $calc($gettok($readini(slots.ini,Stats,$nick),4,32) + 1) 
          msg $chan 4%$@#$$%###$$%$%^&*%*@$%@%
          msg $chan Sorry looks like you lost $+($chr(36),$2) : $+ $chr(40) 
        } 
      } 
      else { msg $chan You don't have $2 dollars } 
    } 
    else if ($regml(1) == mug && $istok($readini(slots.ini,Users,Users),$2,32)) { 
      var %chance = $r(1,100) 
      if (%chance > 80) { 
        writeini slots.ini Stats $nick $calc($gettok($readini(slots.ini,Stats,$nick),1,32) + 100) $gettok($readini(slots.ini,Stats,$nick),2-4,32) 
        writeini slots.ini Stats $2 $calc($gettok($readini(slots.ini,Stats,$2),1,32) - 100) $gettok($readini(slots.ini,Stats,$2),2-4,32) 
        msg $chan $nick has taken 100 from $2 $+ ! Better get a bigger safe $2 $+ . 
      } 
      else if (%chance < 10) { 
        writeini slots.ini Stats $nick $calc($gettok($readini(slots.ini,Stats,$nick),1,32) - 100) $gettok($readini(slots.ini,Stats,$nick),2-4,32) 
        writeini slots.ini Stats $2 $calc($gettok($readini(slots.ini,Stats,$2),1,32) + 100) $gettok($readini(slots.ini,Stats,$2),2-4,32) 
        msg $chan $2 has found out about $nick $+ 's plan and moved their money. $nick finds themself in a gutter and all 100 dollars gone! 
      } 
      else { msg $chan $nick got lost on their way and gave up after 3 hours of looking. $2 doesn't even know $nick tried to mug them. } 
    } 
  } 
  else { msg $chan Your not logged in. If you need help type !help command } 
} 

on $*:text:/^[!@`~](identify|register)/Si:?: { 
  if ($regml(1) == register && $2) { 
    if (!$istok($readini(slots.ini,Users,Users),$nick,32)) { 
      $iif($readini(slots.ini,Users,Users),writeini slots.ini Users Users $readini(slots.ini,Users,Users) $nick,writeini slots.ini Users Users $nick) 
      writeini slots.ini Users $nick $2 
      writeini slots.ini Stats $nick 500 500 0 0 
    } 
    else { msg $nick Your already registered } 
  } 
  else if ($regml(1) == identify && !$istok($readini(slots.ini,Ident,Users),$nick,32)) { 
    if ($nick == $gettok($readini(slots.ini,Admin,Owner),1,32)) { 
      $iif($2 == $gettok($readini(slots.ini,Admin,Owner),2,32),$iif($readini(slots.ini,Ident,Users),writeini slots.ini Ident Users $readini(slots.ini,Ident,Users) $nick,writeini slots.ini Ident Users $nick),msg $nick Wrong Password) 
    } 
    else { 
      $iif($2 == $readini(slots.ini,Users,$nick),$iif($readini(slots.ini,Ident,Users),writeini slots.ini Ident Users $readini(slots.ini,Ident,Users) $nick,writeini slots.ini Ident Users $nick),msg $nick Wrong Password) 
    } 
  } 
  close -m $nick 
} 

on $*:text:/^[!@`~](help register|help identify|help bank|help withdraw|help deposit|help slots)/Si:#: { 
  if ($regml(1) == help register) { msg $chan To register PM $me !register password. } 
  else if ($regml(1) == help identify) { msg $chan To identify PM $me !identify password. } 
  else if ($regml(1) == help bank) { msg $chan Will tell you how much cash you have on you and in the bank. } 
  else if (regml(1) == help withdraw) { msg $chan Will take money out of your bank. } 
  else if ($regml(1) == help deposit) { msg $chan Will add money to your bank. } 
  else if ($regml(1) == help slots) { msg $chan Will give or take money from you based on the outcome. } 
} 

on *:part:#: { 
  if ($istok($readini(slots.ini,Ident,Users),$nick,32)) { 
    $iif($numtok($readini(slots.ini,Ident,Users),32) > 1,writeini slots.ini Ident Users $remove($readini(slots.ini,Ident,Users),$nick),remini slots.ini Ident Users) 
  } 
} 

on *:nick: { 
  if ($istok($readini(slots.ini,Ident,Users),$nick,32)) { 
    $iif($numtok($readini(slots.ini,Ident,Users),32) > 1,writeini slots.ini Ident Users $remove($readini(slots.ini,Ident,Users),$nick),remini slots.ini Ident Users) 
  } 
} 

alias setup_slots { 
  var %owner = $$?="Enter Owner Nick" 
  var %owner_pass $$?="Enter a Password" 
  writeini slots.ini Admin Owner %owner %owner_pass 
  writeini slots.ini Admin Users %owner 
  writeini slots.ini Users Users %owner 
  writeini slots.ini Stats %owner 1000 500 0 0 
  echo -a **** Setup Complete **** 
}

Comments

Sign in to comment.
airsfotglock   -  Aug 07, 2010

lmao you guys are like lighting with this look here. http://www.hawkee.com/phpBB2/viewtopic.php?t=21716 sry im just scripting an awesome ass bank script im scripting a whole bot.

 Respond  
napa182   -  Aug 07, 2010

a good place to start regular-expressions info

 Respond  
Aucun50   -  Aug 07, 2010

I would have to play with them a lot like I did with sockets before I get a hang of it, don't really have the time I did before to start scripting. Maybe I'll have a look at some more tutorials about regex but all the \ / * < > non sense makes me look at it and say... wth that doesn't make sense what does all that do :o

 Respond  
Jethro   -  Aug 07, 2010

Aucun50, if napa182 can do it, so can you. Regex is very handy if you try harder to understand how it works. Once you get the hang of it, it's gonna benefit you tremendously when it comes to sockets. Regex is also versatile, universal and helpful if someday you decide to learn or move on to another scripting language.

 Respond  
napa182   -  Aug 07, 2010

\s matches any whitespace character and \b anchors the regex at a word boundary or the position between a word and a non-word character, or vice versa.

also i don't really see the point in all the chrs you are using for the trigger unless you are going to make them do diff things. Ie: !@`~

 Respond  
Aucun50   -  Aug 07, 2010

I don't do well with regex napa, I was thinking something like that but what I tried didn't work at all so I keep the long way. Thanks for the tip, still don't know what the /s after help and \b/ does if you could tell me :)

 Respond  
napa182   -  Aug 07, 2010

why the redundancy in the on text regexs?

on $*:text:/^[!@`~](help register|help identify|help bank|help withdraw|help deposit|help slots)/Si:#: {

you could have done

on $*:text:/^[!@`~]help\s(register|identify|bank|withdraw|deposit|slots)\b/Si:#:{

then instead of using

if ($regml(1) == help register)

you can use

if ($regml(1) = register)
 Respond  
Aucun50   -  Aug 07, 2010

Was going to say wow you script a lot like I do then I seen in the description ;)

 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.