Gangster RPG

By `JoKeR´ on Nov 26, 2008

I finally finished the shell for the Gangster Bot Purcell had asked for. I've added a few little snippets in there for easy addition of items. You are free to use this bot as you wish, but please give credit where credit is due. This was created from scratch, 100% by me.

Enjoy.

on *:load:{
  .write gangster.txt 0
}

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

on *:text:.gangster*:?:{
  if !$2 || !$3 || $2 !isalnum || $3 !isalnum {
    .notice $nick .gangster <name> <password>
  }
  if $gettok($read(gangster.txt,w,$2),2,32) !== $null {
    .msg # That name has been taken.
    halt
  }
  else {
    hmake $nick
    hadd $nick name $2
    hadd $nick pass $3
    hadd $nick cash 1000
    hadd $nick atk 5
    hadd $nick def 5
    hadd $nick atk_mod 0
    hadd $nick def_mod 0
    hadd $nick points 0
    hadd $nick level 1
    hsave -i $nick gangster.ini $hget($nick,name)
    write -l1 gangster.txt $calc($read(gangster.txt,-1) + 1)
    write gangster.txt $nick $2
    .msg # Welcome to Gangsters, $2 $+($chr(40),$nick,$chr(41))
    .notice $nick Type .help for a list of commands.
    stats
  }
}

on *:text:.crime*:#:{
  if !$hget($nick) {
    .notice $nick .gangster <name> <password>
    halt
  }
  if $hget($nick,jail) {
    .notice $nick You cannot do that while in jail.
    halt
  }
  else {
    if !$2 {
      .notice $nick Crimes: mug; carjack;
    }
    if $2 = mug {
      if !$hfind($nick,mugging) {
        var %x $rand(100,300)
        var %cash $calc($hget($nick,cash) + %x)
        hadd $nick cash %cash
        hadd -z $nick mugging 60
        .msg # $hget($nick,name) mugs an unsuspecting pedestrian for $+($chr(36),$bytes(%x,b),.)
        .notice $nick Total Cash: $+($chr(36),$bytes($hget($nick,cash),b))
      }
      else {
        .notice $nick You have to wait $+($duration($hget($nick,mugging),3),.)
        halt
      }
    }
    if $2 = carjack {
      if !$hfind($nick,carjack) {
        var %x $rand(0,100)
        if %x <= 20 {
          .msg # $hget($nick,name) finds an unlocked car. They proceed to hotwire the car and drive away.
          .notice $nick You have obtained 1 car.
          hadd $nick cars $calc($hget($nick,cars) + 1)
          var %carjack $rand(60,180)
          hadd -z $nick carjack %carjack
        }
        if %x > 20 && %x <= 50 {
          var %jail.time $rand(60,300)
          .msg # $hget($nick,name) was caught trying to steal a car and is sent to jail for $+($duration(%jail.time,3),.)
          hadd -z $nick jail %jail.time
          var %carjack $rand(60,180)
          hadd -z $nick carjack %carjack
        }
        if %x > 50 && %x <= 100 {
          var %cash $rand(500,2000)
          .msg # $hget($nick,name) finds a car and breaks into it. Taking it to a local chop shop, $hget($nick,name) gets $+($chr(36),$bytes(%cash,b),.)
          hadd $nick cash $calc($hget($nick,cash) + %cash)
          var %carjack $rand(60,180)
          hadd -z $nick carjack %carjack
          .notice $nick Total cash: $+($chr(36),$bytes($hget($nick,cash),b))
        }
        hsave -i $nick gangster.ini $hget($nick,name)
      }
      else {
        .notice $nick You have to wait $+($duration($hget($nick,carjack),3),.)
        halt
      }
    }
  }
}

on *:text:.buy*:#:{
  if !$hget($nick) {
    .notice $nick .gangster <name> <password>
    halt
  }
  if $hget($nick,jail) {
    .notice $nick You cannot do that while in jail.
    halt
  }
  else {
    if !$2 {
      ;//Edit these to your liking.
      .notice $nick Shops: Armor;  Weapon;  Car;
      halt
    }
    if $2 = armor {
      ;//ITEM_NAME [ITEM_HASH] PRICE
      ;//I did it this way so you can show what the item is, and have something
      ;//to put in the hash table without spamming it.
      .notice $nick Armors: Bulletproof Vest [bpvest] $+($chr(36),500,;)
    }
    if $2 = weapon {
      .notice $nick Weapons: Machette [machette] $+($chr(36),500,;) - Glock [glock] $+($chr(36),750,;)
    }
    if $2 = car {
      .notice $nick Cars: Rolls Royce [rolls] $+($chr(36),$bytes(10000,b),;)
    }
    if $2 !isnum {
      .notice $nick .buy <num> <item>
      halt
    }

    /*
    This is the template you can use to make new items.
    Just change anything that says CHANGE_ME.

    if $2 isnum && $3 = CHANGE_ME {
      var %cash $calc($2 * CHANGE_ME)
      if $hget($nick,cash) >= %cash {
        hadd $nick cash $calc($hget($nick,cash) - %cash)
        hadd $nick CHANGE_ME $calc($hget($nick,CHANGE_ME) + $2)
        hadd $nick def_mod $calc($hget($nick,def_mod) + (CHANGE_ME * $2))
        hadd $nick atk_mod $calc($hget($nick,atk_mod) + (CHANGE_ME * $2))
        .msg # $nick buys $2 CHANGE_ME.
      }
    }
    */

    ;########### ARMORS ###########

    if $2 isnum && $3 = bpvest {
      var %cash $calc($2 * 500)
      if $hget($nick,cash) >= %cash {
        hadd $nick cash $calc($hget($nick,cash) - %cash)
        hadd $nick bp_vest $calc($hget($nick,bp_vest) + $2)
        hadd $nick def_mod $calc($hget($nick,def_mod) + (2 * $2))
        hadd $nick atk_mod $calc($hget($nick,atk_mod) + (1 * $2))
        .msg # $nick buys $2 Bulletproof Vest.
      }
    }

    ;########### WEAPONS ###########

    if $2 isnum && $3 = machette {
      var %cash $calc($2 * 500)
      if $hget($nick,cash) >= %cash {
        hadd $nick cash $calc($hget($nick,cash) - %cash)
        hadd $nick machette $calc($hget($nick,machette) + $2)
        hadd $nick def_mod $calc($hget($nick,def_mod) + (1 * $2))
        hadd $nick atk_mod $calc($hget($nick,atk_mod) + (3 * $2))
        .msg # $nick buys $2 Machette.
      }
    }
    if $2 isnum && $3 = glock {
      var %cash $calc($2 * 750)
      if $hget($nick,cash) >= %cash {
        hadd $nick cash $calc($hget($nick,cash) - %cash)
        hadd $nick glock $calc($hget($nick,glock) + $2)
        hadd $nick def_mod $calc($hget($nick,def_mod) + (2 * $2))
        hadd $nick atk_mod $calc($hget($nick,atk_mod) + (4 * $2))
        .msg # $nick buys $2 Glock.
      }
    }

    ;########### CARS ###########

    if $2 isnum && $3 = rolls {
      var %cash $calc($2 * 10000)
      if $hget($nick,cash) >= %cash {
        hadd $nick cash $calc($hget($nick,cash) - %cash)
        hadd $nick rolls $calc($hget($nick,rolls) + $2)
        hadd $nick def_mod $calc($hget($nick,def_mod) + (10 * $2))
        hadd $nick atk_mod $calc($hget($nick,atk_mod) + (13 * $2))
        .msg # $nick buys $2 Rolls Royce.
      }
    }

    ;########### END ###########
    hsave -i $nick gangster.ini $hget($nick,name)
  }
}

on *:text:.attack*:#:{
  if !$hget($nick) {
    .notice $nick .gangster <name> <password>
    halt
  }
  if $hget($nick,jail) {
    .notice $nick You cannot do that while in jail.
    halt
  }
  if $hget($nick,attack) {
    halt
  }
  if !$2 || !$gettok($read(gangster.txt,w,$+(*,$2)),2,32) {
    .notice $nick .attack <name>
    halt
  }
  else {
    var %def $gettok($read(gangster.txt,w,$+(*,$2)),1,32)
    var %atk.calc $calc(($hget($nick,atk) * $hget($nick,def)) + ($hget($nick,atk_mod) * $hget($nick,def_mod)) + ($hget($nick,level) * 1.5)) * $+(1.,$rand(1,9)))
    var %def.calc $calc((($hget(%def,atk) * $hget(%def,def)) + ($hget(%def,atk_mod) * $hget(%def,def_mod)) + ($hget(%def,level) * 1.5)) * $+(1.,$rand(1,9)))
    hadd -z $nick attack 10
    if %atk.calc > %def.calc {
      var %a $hget(%def,cash)
      var %b $floor($rand($calc(%a/2),%a))
      hadd %def cash $calc($hget(%def,cash) - %b)
      hadd $nick cash $calc($hget($nick,cash) + %b)
      .msg # $hget($nick,name) defeats $hget(%def,name) in battle, stealing $+($chr(36),$bytes(%b,b),.)
    }
    else {
      var %c $hget($nick,cash)
      var %d $floor($rand($calc(%c/2),%c))
      hadd $nick cash $calc($hget($nick,cash) - %d)
      hadd %def cash $calc($hget(%def,cash) + %d)
      .msg # $hget(%def,name) defeats $hget($nick,name) in battle, stealing $+($chr(36),$bytes(%d,b),.)
    }
  }
}

on *:text:.stats:#:{
  if !$hget($nick) {
    .notice $nick .gangster <name> <password>
    halt
  }
  else {
    stats
  }
}

on *:text:.help:#:{
  if !$2 {
    .notice $nick .gangster; .crime; .buy; .stats;
  }
}

alias stats {
  .notice $nick [Level: $+($hget($nick,level),]) [Cash: $+($chr(36),$bytes($hget($nick,cash),b),]) $&
    [Attack: $+($hget($nick,atk),]) [Defense: $+($hget($nick,def),]) [Points: $+($hget($nick,points),]) $&
    [Attack Bonus: $+($hget($nick,atk_mod),]) [Defense Bonus: $+($hget($nick,def_mod),])
}

Comments

Sign in to comment.
cptpan   -  Jul 14, 2014

We have fully redeveloped this game in another language and it all works great!

Come and check it out: http://www.textgangsters.com

 Respond  
cptpan   -  Apr 21, 2014

~

 Respond  
cptpan   -  Oct 08, 2012

~

 Respond  
cptpan   -  Aug 25, 2012

~

 Respond  
cptpan   -  May 13, 2012

~

 Respond  
FutureTrunks   -  Oct 21, 2011

I'm new to Hawkee and to bot scripting,so how do i start it up? Like `register or what?

 Respond  
SimplicityX   -  Aug 29, 2010
  if !$2 || !$3 || $2 !isalnum || $3 !isalnum {

Is it really needed to use !$3? If there's no $2, why would there be a $3..?

 Respond  
winL1nks   -  Aug 26, 2010

OMYGAWD CAN YEU PLEASE FIX TEH .GANGSTER COMMAND CUZ IT WONT WURK AND I CANT REGISTER . |:

 Respond  
Kardadantis   -  Jun 16, 2010

can someone fix this damn error? * Invalid format: $floor

 Respond  
cptpan   -  Jun 15, 2010

~

 Respond  
Kardadantis   -  Jun 10, 2010

levelup update

on :text:.levelup:#:{
if !$hget($nick) {
.notice $nick .gangster
halt
}
if $hget($nick,jail) {
.notice $nick negali to daryt kol sedi kalejime.
halt
}
else {
if $2 !isnum {
.notice $nick .levelup level
.notice $nick lygio pakelimo kaina 100 tasku.
halt
}

;########### LEVELS ###########

if $2 isnum && $3 = level {
  var %points $calc($2 * 100)
  if $hget($nick,points) >= %points {
    hadd $nick points $calc($hget($nick,points) - %points)
    hadd $nick level $calc($hget($nick,level) + $2)
    hadd $nick def $calc($hget($nick,def) + (5 * $2))
    hadd $nick atk $calc($hget($nick,atk) + (5 * $2))
    .msg # $nick pereina i kita lygi.
  }
}

;########### END ###########
hsave -i $nick gangster.ini $hget($nick,name)

}
}

text in LT

 Respond  
Kardadantis   -  Jun 10, 2010

points update for crime carjack

if %x > 20 && %x <= 50 {
var %jail.time $rand(60,300)
var %points $rand(1,5)
.msg # $hget($nick,name) buvo pagauta(s) bandant nuvarit masina ir pasodinta(s) i kalejima $+($duration(%jail.time,3),.)
hadd -z $nick jail %jail.time
hadd $nick points $calc($hget($nick,points) - %points)
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
.notice $nick tasku: $+($chr(36),$bytes($hget($nick,points),b))
}
if %x > 50 && %x <= 100 {
var %cash $rand(1000,5000)
var %points $rand(1,5)
.msg # $hget($nick,name) randa masina ir isilauzia i ja. nuvaro ja i vietine superktuve, $hget($nick,name) ir gauna $+($chr(36),$bytes(%cash,b),.)
hadd $nick cash $calc($hget($nick,cash) + %cash)
hadd $nick points $calc($hget($nick,points) + %points)
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
.notice $nick isviso grinu: $+($chr(36),$bytes($hget($nick,cash),b)) tasku: $+($chr(36),$bytes($hget($nick,points),b))

sorry, text in LT :)

 Respond  
Kardadantis   -  Jun 08, 2010

if bot restart or disconnect it loose all info about players and you need to register again from zero :/

 Respond  
Kardadantis   -  Jun 08, 2010

.attack not working at all, becoase of $floor :(((

 Respond  
cptpan   -  Mar 29, 2010

Things progress, and I'm forced to work on it myself without help.

Not to mention as time passes I find more and more errors.

 Respond  
Jethro   -  Mar 29, 2010

cptpan, perhaps you should think before making a comment, so that you won't wind up with so many of them to begin with.

 Respond  
cptpan   -  Mar 29, 2010

omfg I finally get a comment and its as useless as this script.

IT'S BECAUSE I CAN'T DELETE MY OWN SH1T ON HERE

 Respond  
napa182   -  Mar 28, 2010

cptpan you seem to have a problem with flooding peoples snippets with comments.. =/

 Respond  
cptpan   -  Mar 28, 2010

HELLO 2 ANY1?

 Respond  
cptpan   -  Mar 26, 2010

Doesn't fix it for when the computer restarts, though.

This script has MANY issues...........

 Respond  
cptpan   -  Mar 26, 2010

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

That fixes the screw up when the bot disconnects

 Respond  
cptpan   -  Mar 26, 2010
  1. How do you get points?

  2. How do you check what peoples names are if they can just make them up?

  3. Is there a way to export a list of the names to a website so everyone can see people who are playing, and what money they have?
 Respond  
cptpan   -  Mar 26, 2010

edit Never mind

 Respond  
cptpan   -  Mar 26, 2010

edit Never mind

 Respond  
cptpan   -  Mar 26, 2010

edit Never mind

 Respond  
cptpan   -  Mar 25, 2010

edit Never mind

 Respond  
Pangaea   -  Jan 13, 2010

has anyone any idea at all how to work this?

@kyle ... just load the script in u r BOT by pressing Alt+R and then type .help
dose nothing at all

neither dose
.gangster

what are the commands for this? isnt there a list of commands or some sort of help, how are ppl ment to know what to do? there are no dialogs so its difficult to know, and reading the code is jsut dam confusing

"I finally finished the shell for the Gangster Bot Purcell had asked for. I've added a few little snippets in there for easy addition of items. You are free to use this bot as you wish, but please give credit where credit is due. This was created from scratch, 100% by me."

? i think u forgot to exaplin how to play it ;)

 Respond  
Ghost-writer   -  Aug 23, 2009

I made a script excatly like this but with a little bit more stuff and no jail and everyone said that yours is like it, But i look and find out this has been here for a few months now how the hell did i NOT see it. lol :|.

 Respond  
Xaric   -  Aug 02, 2009

is there an update version with more weapons etc?

 Respond  
VinX   -  Aug 02, 2009

@kyle ... just load the script in u r BOT by pressing Alt+R and then type .help

@Joker

Sweet script :)) I love it .. kinda addicted

 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.