Last Man Standing

By AlexRapso on May 19, 2010

Another game i've made while being bored....

Instructions are in the game type !commands in the game channel or !help/!commands in the pm of the bot.

I suggest not owning the bot if you have a slow internet connection.

Might add some extra stuff later if i feel like it :P

Enjoy :)

on *:LOAD: {
  echo -a 14Last Man Standing Script 4©14 Rapso
  echo -a Please type !setowner in a channel with me to set yourself as the owner.
  echo -a Please type !chan (chan) to set the chan you want to play in.
}
on *:text:!setowner*:#:{
  if (!%owner) {
    set %owner $address($nick, 2)
    msg $chan $nick you are my new owner.
  }
}
on *:text:!chan*:#:{
  if ($address($nick,2) == %owner) {
    if (%started == on) { msg $chan The game is already on, turn it off | halt } 
    set %chan $2
    msg $chan Channel has been set to $2
  }
}
on *:text:!start*:%chan:{
  if (%started == on) { msg $chan The game is already on | halt }
  if (%gameon == on) { msg $chan The game is already on | halt }
  set %started on
  msg $chan You have 60 seconds to !join then the game starts 
  timer 1 30 msg $chan 30 seconds left to join!
  timer 1 50 msg $chan 10 seconds left to join get ready!
  timer 1 60 msg $chan Ok times up!
  timer 1 61 /gamestarts $chan
}
on *:text:!off*:%chan:{
  if ($address($nick,2) == %owner) {
    unset %started
    unset %gameon 
    unset %round
    unset %currentplayer
    unset %currentplayer2
    unset %randir 
    unset %ohyes
    unset %roundnum
    unset %pmnick
    set %count 1
    while (%count <= %top) {    
      /hdel -w health [ %player [ $+ [ %count ] ] ]
      /hdel -w money [ %player [ $+ [ %count ] ] ]
      /hdel -w defence [ %player [ $+ [ %count ] ] ]
      /hdel -w attack [ %player [ $+ [ %count ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] ]
      unset [ %kill [ $+ [ %player [ $+ [ %count ] ] ] ] 
      unset %player [ $+ [ %count ] ] ] 
      set %count $calc(%count + 1)
    }
    unset %count
    unset %top 
    /timers off
    /mode $chan -m
    msg $chan Off o/
  }
}
on *:text:!join*:%chan:{
  if (%started != on) { msg $chan Please turn the game on first | halt }
  if (%gameon == on) { msg $chan Sorry the game is already on | halt }
  /nickcheck $chan $nick
  msg $chan $nick you have joined the game
  msg $nick For help type !help or to view the shop type !shop here in pm 
  if (!%top) { set %top 0 }
  /mode # +v $nick
  set %top $calc(%top + 1)
  set [ %player [ $+ [ %top ] ] ] $nick
  hadd -m health [ %player [ $+ [ %top ] ] ] 100
  hadd -m attack [ %player [ $+ [ %top ] ] ] 50
  hadd -m defence [ %player [ $+ [ %top ] ] ] 50
  hadd -m money [ %player [ $+ [ %top ] ] ] 20000
}
alias nickcheck {
  set %count 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $2) { msg $1 You are already in the game | halt }
    set %count $calc(%count + 1)
  }
}
alias gamestarts {
  if (!%top) { msg $1 There was not enough people to start the game | /goff | halt }
  if (%top < 2) { msg $1 There was not enough people to start the game | /goff | halt }
  /mode $1 +m
  set %gameon on
  set %count 1
  while (%count <= %top) {
    /mode $1 +v [ %player [ $+ [ %count ] ] ]
    set %count $calc(%count + 1)
  }
  /msg $1 For The Last Man Standing Shop: http://pastebin.com/bjUXxkTU 
  /roundon $1
}
alias roundon {
  if (!%roundnum) { set %roundnum 0 }
  inc %roundnum
  set %count 1
  while (%count <= %top) {
    unset [ %kill [ $+ [ %player [ $+ [ %count ] ] ] ] 
    set %count $calc(%count + 1)
  }
  set %count 1
  while (%count <= %top) {
    /mode $1 +v [ %player [ $+ [ %count ] ] ]
    set %count $calc(%count + 1)
  }
  msg $1 Let the killing begin | set %round on | /timer 1 45 /roundoff $1
}
alias roundoff {
  set %count 1
  while (%count <= %top) {
    /mode $1 -v [ %player [ $+ [ %count ] ] ]
    set %count $calc(%count + 1)
  }
  set %count 1
  while (%count <= %top) {
    /hinc money [ %player [ $+ [ %count ] ] ] $calc(20000 + (%roundnum * 5000))
    set %count $calc(%count + 1)
  }
  msg $1 Ok stop killing! | set %round off
  msg $1 € $+ $calc(20000 + (%roundnum * 5000)) has been added to everyone alive!
  /timer 1 30 msg $1 Next round starts in 30 seconds
  /timer 1 50 msg $1 next round starts in 10 seconds
  /timer 1 60 /roundon $1 
}
on *:text:!shoot*:%chan:{
  if (%gameon != on) { msg $chan The game isn't on | halt }
  if (%round != on) { msg $chan You cannot shoot at the moment | halt }
  if ([ %kill [ $+ [ $2 ] ] ] == on) { msg $chan $2 has already been attacked once this round | halt }
  if (!$2) { halt }
  if ($2 == $nick) { halt }
  if (%stopper == on) { halt }
  set %stopper on
  /timer 1 4 unset %stopper
  set %count 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $2) { 
      set %kill $+ %player [ $+ [ %count ] ] on
      set %ifyes on 
      set %currentplayer [ %player [ $+ [ %count ] ] ] 
    }
    set %count $calc(%count + 1)
  }
  if (%ifyes != on) { msg $chan This person is not playing the game | unset %ifyes | halt }
  else {
    set %count 1
    while (%count <= %top) {
      if ([ %player [ $+ [ %count ] ] ] == $nick) { set %currentplayer2 [ %player [ $+ [ %count ] ] ] | unset %ifyes }
      set %count $calc(%count + 1)
    }
    /shooting $chan $nick $2 
  }
}
alias shooting {
  var %attack = $calc($hget(attack, %currentplayer2) - $hget(defence, %currentplayer))
  var %backfire = $calc($hget(defence, %currentplayer2) - $hget(attack, %currentplayer))
  if (%attack > 0) && (%backfire > 0) {
    var %combined = $calc(%attack + %backfire)
    if (%combined < 10) { msg $1 $2 made a small attack on $3 | hdec health %currentplayer $rand(15,30) }
    if (%combined >= 10) && (%combined < 40) { msg $1 $2 shot at $3 and did a bit of damage | hdec health %currentplayer $rand(25,40) }
    if (%combined >= 40) && (%combined < 60) { msg $1 $2 performed a medium attack on $3 | hdec health %currentplayer $rand(40,60) }
    if (%combined >= 60) && (%combined < 70) { msg $1 $2 shot $3 and did a hell of a lot of damage | hdec health %currentplayer $rand(60,80) }
    if (%combined >= 70) { 
      msg $1 $2 made a good shot and hit $3 right in the head 
      hdec health %currentplayer 120
    }
  }
  if (%attack < 0) && (%backfire > 0) {
    if (%attack > -10) { msg $1 $2 made a small attack on $3 | hdec health %currentplayer $rand(10,20) }
    if (%attack <= -10) && (%attack > -40) { msg $1 $2 shot at $3 but didnt do much damage | hdec health %currentplayer $rand(0,15) }
    if (%attack <= -40) && (%attack > -60) { msg $1 $2 shot at $3 but on gave them a flesh wound | hdec health %currentplayer $rand(0,5) }
    if (%attack <= -60) { 
      if (%backfire < 10) { msg $1 $2 missed $3 and hit a tree, $3 hit back and did a good ammount of damage | hdec health %currentplayer2 $rand(40,60) }
      if (%backfire >= 10) && (%backfire < 40) { msg $1 $2 completely missed $3 improve your attack, $3 managed to get a shot off and do some damage  | hdec health %currentplayer2 $rand(25,40) }
      if (%backfire >= 40) && (%backfire < 60) { msg $1 $2 your attack is weak! $3 did a bit of damage to you | hdec health %currentplayer2 $rand(15,30) }
      if (%backfire >= 60) { msg $1 both $2 and $3 missed, what a fail :/ }
    }
  }
  if (%attack > 0) && (%backfire < 0) {
    if (%attack < 10) { 
      if (%backfire > -10) { msg $1 $2 performed a small attack, $3 hit back and did some damage aswell | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(15,30) }
      if (%backfire <= -10) && (%backfire > -40) { msg $1 $2 shot $3 but didnt do much damage, $3 hit back and did a lot better | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(40,60) }
      if (%backfire <= -40) && (%backfire > -60) { msg $1 $2 shot $3 but didnt do much damage, $3 hit back and did loads of damage | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(60,80) }
      if (%backfire <= -60) { msg $1 $2 managed to shoot $3 but wasn't strong enough, $3 shot back and killed $2 | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer 100 }
    }
    if (%attack >= 10) && (%attack < 40) { msg $1 $2 managed to do a small ammount of damage | hdec health %currentplayer $rand(20,40) }
    if (%attack >= 40) && (%attack < 60) { msg $1 $2 did big damage on $3 | hdec health %currentplayer $rand(40,70) }
    if (%attack >= 60) { msg $1 $2 made a perfect shot and killed $3 | hdec health %currentplayer 100 }
  }
  if (%attack < 0) && (%backfire < 0) {
    var %combined = $calc(%attack + %backfire)
    if (%combined > -10) { msg $1 $2 managed a small attack on $3 | hdec health %currentplayer $rand(15,30) }
    if (%combined <= -10) && (%combined > -40) { msg $1 $2 made very small damage to $3 | hdec health %currentplayer $rand(10,20) }
    if (%combined <= -40) && (%combined > -60) { msg $1 $2 missed and took some damage from $3 | hdec health %currentplayer2 $rand(25,40) }
    if (%combined <= -60) && (%combined > -70) { msg $1 $2 missed and took alot of damage from $3 | hdec health %currentplayer2 $rand(40,70) }
    if (%combined <= -70) { msg $1 $2 missed and was killed by $3 | hdec health %currentplayer2 100 }
  }
  if (%attack = 0) && (%backfire = 0) {
    set %randir $rand(1,100)
    if (%randir < 10) { msg $1 $2 managed a small attack on $3 | hdec health %currentplayer $rand(15,30) }
    if (%randir >= 10) && (%randir < 35) { msg $1 $2 shot $3 and managed quite a lot of damage | hdec health %currentplayer $rand(40,70) }
    if (%randir >= 35) && (%randir < 40) { msg $1 $2 made an awesome shot and killed $3  | hdec health %currentplayer 100 }
    if (%randir >= 40) && (%randir < 60) { msg $1 $2 performed a small attack, $3 hit back and did some damage aswell | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(15,30) }
    if (%randir >= 60) && (%randir < 77) { msg $1 $2 missed and took some damage from $3 | hdec health %currentplayer2 $rand(15,30) }
    if (%randir >= 77) && (%randir < 80) { msg $1 $2 shot and killed $3 just as $3 pulled the trigger on $2 | hdec health %currentplayer 100 | hdec health %currentplayer2 100 }
    if (%randir >= 80) && (%randir < 90) { msg $1 $2 performed a medium attack on $3 | hdec health %currentplayer $rand(40,60) }
    if (%randir >= 90) && (%randir <= 100) { msg $1 $2 shot $3 and did medium damage, $3 shot back with the same force | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(40,60) }
  }
  if (%attack = 0) && (%backfire > 0) {
    if (%backfire < 20) { msg $1 $2 managed a small attack on $3 | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(15,30) }
    if (%backfire >= 20) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 shot $3 and did medium damage, $3 shot back and did small damage | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 2) { msg $1 $2 shot $3 and did some nice damage | hdec health %currentplayer $rand(40,60) }
      if (%randir == 3) { msg $1 both $2 and $3 missed, what a fail :/ }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 65) { msg $1 $2 jumps through the air, filling $3 with bullet holes, hes long gone from this world | hdec health %currentplayer 100 }
        else { msg $1 $2 shot $3 and did some nice damage | hdec health %currentplayer $rand(40,60) }
      }
    }
  }
  if (%attack = 0) && (%backfire < 0) {
    if (%backfire > -20) { msg $1 $2 performed a small attack, $3 hit back and did some damage aswell | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(15,30) }
    if (%backfire <= -20) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 shot $3 and did quite a lot of damage, $3 hit back and did some damage aswell | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 2) { msg $1 $2 managed to do some nice damage to $3 $+ , $3 hit back and managed a medium attack on $2 | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 3) { msg $1 $2 completely misses $3 $+ , this gives $3 the chance to do huge damage to $2 | hdec health %currentplayer2 $rand(60,80) }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 65) { msg $1 $2 jumps through the air, filling $3 with bullet holes, hes long gone from this world | hdec health %currentplayer 100 }
        if (%randir >= 65) && (%randir < 70) { msg $1 $2 jumps out of the middle of no where, but $3 is ready for him and $2 dies from the pain | hdec health %currentplayer2 100 }
        else { msg $1 $2 shot $3 and did some nice damage, $3 shot back with equal force | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(40,60) }
      }
    }
  }
  if (%attack > 0) && (%backfire = 0) {
    if (%attack < 10) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 performed a small attack, $3 hit back and did some damage aswell | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 2) { msg $1 $2 managed to do some nice damage to $3 $+ , $3 hit back and managed a medium attack on $2 | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 3) { msg $1 $2 completely missed, this gave $3 the chance to get a good shot on $2 | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 65) { $2 jumps through the air, filling $3 with bullet holes, hes long gone from this world | hdec health %currentplayer 100 }
        if (%randir >= 65) && (%randir < 70) { msg $1 $2 jumps out of the middle of no where, but $3 is ready for him and $2 dies from the pain | hdec health %currentplayer2 100 }
        else { msg $1 $2 shot $3 and did quite a lot of damage, $3 hit back and did some damage aswell | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(15,30) }
      }
    }
    if (%attack >= 10) && (%attack < 40) { msg $1 $2 managed to shoot $3 and get some good damage, $3 scrambles away in pain | hdec health %currentplayer $rand(40,60) }
    if (%attack >= 40) && (%attack < 60) { msg $1 $2 shot $3 in the stomach but was it enough to kill them? | hdec health %currentplayer $rand(60,80) }
    if (%attack >= 60) { msg $1 $2 sneaks behind $3 and fills him with bullet holes | hdec health %currentplayer 100 }
  }
  if (%attack < 0) && (%backfire = 0) {
    if (%attack > -10) { msg $1 $2 performed a small attack on $3 $+ , $3 runs off as fast as they can | hdec health %currentplayer $rand(15,30) }
    if (%attack <= -10) && (%attack > -40) { msg $1 $2 shot at $3 but didnt do much damage, $3 shot back but didn't have much luck either | hdec health %currentplayer $rand(5,15) | hdec health %currentplayer2 $rand(15,30) }
    if (%attack <= -40) {
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 shot $3 but didn't do much damage, $3 hit back with great force | hdec health %currentplayer $rand(0,15) | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 2) { msg $1 $2 did hardly any damage, $3 hit $2 in the chest with some bullets was it enough? | hdec health %currentplayer $rand(0,10) | hdec health %currentplayer2 $rand(50,90) }
      if (%randir == 3) { msg $1 $2 misses $3 completely, $3 is way too strong and kills $2 | hdec health %currentplayer2 100 }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 70) { msg $1 $2 jumps out of the middle of no where, but $3 is ready for him and $2 dies from the pain | hdec health %currentplayer2 100 }
        else { msg $1 $2 shot $3 but didn't do much damage, $3 hit back with a lot more power | hdec health %currentplayer $rand(0,15) | hdec health %currentplayer2 $rand(40,60) }
      }
    }
  }
  /checkdead $1 $2 $3
}
on *:text:!Grenade*:%chan:{
  if (%gameon != on) { msg $chan The game isn't on | halt }
  if (%round != on) { msg $chan You cannot grenade people at the moment | halt }
  if ([ %kill [ $+ [ $2 ] ] ] == on) { msg $chan $2 has already been attacked once this round | halt }
  if (!$2) { halt }
  if ($2 == $nick) { halt }
  if (%stopper == on) { halt }
  set %stopper on
  /timer 1 4 unset %stopper
  set %count 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $2) { 
      set %kill $+ %player [ $+ [ %count ] ] on
      set %ifyes on 
      set %currentplayer [ %player [ $+ [ %count ] ] ] 
    }
    set %count $calc(%count + 1)
  }
  if (%ifyes != on) { msg $chan This person is not playing the game | unset %ifyes | halt }
  else {
    set %count 1
    while (%count <= %top) {
      if ([ %player [ $+ [ %count ] ] ] == $nick) { 
        if (!% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ]) { msg $chan $nick you don't have grenades | halt }
        set %currentplayer2 [ %player [ $+ [ %count ] ] ] | unset %ifyes 
      }
      set %count $calc(%count + 1)
    }
    /grenade $chan $nick $2 
  }
}
alias grenade {
  var %attack = $calc($hget(attack, %currentplayer2) - $hget(defence, %currentplayer))
  var %backfire = $calc($hget(defence, %currentplayer2) - $hget(attack, %currentplayer))
  if (%attack > 0) && (%backfire > 0) {
    var %combined = $calc(%attack + %backfire)
    if (%combined < 10) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 2) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 3) { msg $1 $2 throws the grenade and does small damage to $3 | hdec health %currentplayer $rand(15,30) }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 70) { msg $1 $2 throws the grenade and blows $3 into a million pieces | hdec health %currentplayer 100 }
        else { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does medium damage | hdec health %currentplayer2 $rand(40,60) }
      }
    }
    if (%combined >= 10) && (%combined < 40) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 2) { msg $1 $2 throws the grenade and does small damage to $3, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 3) { msg $1 $2 $+ 's grenade soars through the air, lands close to $3 and blows their hand off, hope thats not their throwing hand! | hdec health %currentplayer $rand(40,60) }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 70) { msg $1 $2 throws the grenade it bounces off a tree and hits $3 in the face blowing their head off | hdec health %currentplayer2 100 }
        else { msg $1 $2 throws the grenade and does small damage to $3 $+ , $3 jumps out the way and fires back delivering some nice damage | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(40,60) }
      }

    }
    if (%combined >= 40) && (%combined < 60) { msg $1 $2 throws a grenade at $3 $+ , the shrapnal flies at $3 delivering huge damage | hdec health %currentplayer $rand(50,80) }
    if (%combined >= 60) && (%combined < 70) { msg $1 $2 $+ 's grenade lands right next to $3 and delivers huge damage | hdec health %currentplayer $rand(60,80) }
    if (%combined >= 70) { msg $1 $2 $+ 's grenade flies at $3 who doesnt know what to do so they stand their like a fool as it explodes in their face | hdec health %currentplayer 100 }
  }
  if (%attack < 0) && (%backfire > 0) {
    if (%attack > -10) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 2) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(15,30) }
      if (%randir == 3) { msg $1 $2 throws the grenade and does small damage to $3 | hdec health %currentplayer $rand(15,30) }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 65) && (%randir < 70) { msg $1 $2 must feel so lucky, they managed to make an almost impossible throw and blows $3 into pieces | hdec health %currentplayer 100 }
        else { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does quite a lot of damage | hdec health %currentplayer2 $rand(40,60) }
      }
    }
    if (%attack <= -10) && (%attack > -40) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does quite a lot of damage | hdec health %currentplayer $rand(40,60) }
    if (%attack <= -40) && (%attack > -60) { msg $1 $2 $+ 's grenade misses, $3 takes this chance and does big damage to $2 | hdec health %currentplayer $rand(60,80) }
    if (%attack <= -60) { 
      if (%backfire < 10) { 
        set %randir $rand(1,100)
        if (%randir >= 50) && (%randir < 70) { msg $1 $2 you fool you forgot to throw the grenade and you blew yourself up | hdec health %currentplayer 100 }
        else { msg $1 $2 $+ 's grenade misses, $3 takes this chance and does big damage to $2 | hdec health %currentplayer2 $rand(60,80) }
      }
      if (%backfire >= 10) && (%backfire < 40) { $2 $+ 's grenade misses, $3 takes this chance and does big damage to $2 | hdec health %currentplayer2 $rand(50,70) }
      if (%backfire >= 40) && (%backfire < 60) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does quite a lot of damage | hdec health %currentplayer2 $rand(40,60) }
      if (%backfire >= 60) { msg $1 $2 throws the grenade but it is way too far from $3 $+ , who shoots and hits a cow with their bullets }
    }
  }
  if (%attack > 0) && (%backfire < 0) {
    if (%attack < 10) { 
      if (%backfire > -10) { 
        set %randir $rand(1,4)
        if (%randir == 1) { msg $1 $2 throws the grenade but it is way too far from $3 $+ , who shoots and hits a cow with their bullets }
        if (%randir == 2) { msg $1 $2 throws the grenade and does small damage to $3 $+ , $4 shoots $2 and does a small ammount of damage | hdec health %currentplayer $rand(13,50) | hdec health %currentplayer2 $rand(15,30)) }
        if (%randir == 3) { msg $1 $2 manages to hit $3 with the grenade but only delivers medium damage | hdec health %currentplayer $rand(40,60) }
        if (%randir == 4) { 
          set %randir $rand(1,100)
          if (%randir >= 60) && (%randir < 70) { msg $1 $2 throws the grenade but it lands miles from $3 who has already shot $2 right between the eyes | hdec health %currentplayer2 100 }
          else { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does quite a lot of damage | hdec health %currentplayer2 $rand(40,60) }
        }
      }
      if (%backfire <= -10) && (%backfire > -40) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does quite a lot of damage | hdec health %currentplayer2 $rand(40,60) }
      if (%backfire <= -40) && (%backfire > -60) { msg $1 $2 $+ 's grenade misses, $3 takes this chance and does big damage to $2 | hdec health %currentplayer2 $rand(60,80) }
      if (%backfire <= -60) { 
        set %randir $rand(1,100)
        if (%randir >= 40) && (%randir < 70) { msg $1 $2 you fool you forgot to throw the grenade and you blew yourself up | hdec health %currentplayer2 100 }
        else { msg $1 $2 $+ 's grenade misses, $3 takes this chance and does big damage to $2 | hdec health %currentplayer2 $rand(50,80) }      
      }
    }
    if (%attack >= 10) && (%attack < 40) { msg $1 $2 manages to hit $3 with the grenade but only delivers a small ammount of damage | hdec health %currentplayer $rand(20,40) }
    if (%attack >= 40) && (%attack < 60) { msg $1 $2 $+ 's grenade misses, $3 takes this chance and does big damage to $2 | hdec health %currentplayer $rand(60,90) }
    if (%attack >= 60) { msg $1 $2 pulls the pin on the grenade, shoves it in $3 $+ 's mouth and runs off just in time for it to explode | hdec health %currentplayer 100 }
  }
  if (%attack < 0) && (%backfire < 0) {
    var %combined = $calc(%attack + %backfire)
    if (%combined > -10) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(20,30) }
    if (%combined <= -10) && (%combined > -40) { msg $1 $2 throws their grenade right at $3 $+ , $3 catches it and throws it back causing alot of damage to $2 | hdec health %currentplayer2 $rand(50,80) }
    if (%combined <= -40) && (%combined > -60) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does a lot of damage to $2 | hdec health %currentplayer2 $rand(60,90) }
    if (%combined <= -60) { msg $1 $2 misses completely with the grenade, $3 shoots $2 10 times to make sure the job is done | hdec health %currentplayer2 100 }
  }
  if (%attack = 0) && (%backfire = 0) {
    set %randir $rand(1,100)
    if (%randir < 10) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does medium damage to $2 | hdec health %currentplayer2 $rand(40,60) }
    if (%randir >= 10) && (%randir < 35) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does medium damage to $2 | hdec health %currentplayer $rand(40,60) }
    if (%randir >= 35) && (%randir < 40) { msg $1 $2 $+ 's grenade floats through the air and turns $3 into mince meat | hdec health %currentplayer 100 }
    if (%randir >= 40) && (%randir < 60) { msg $1 $2 manages to land the grenade right next to $3 and do alot of damage, $3 whipers off and shoots back at $2 to deliver small damage | hdec health %currentplayer $rand(50,80) | hdec health %currentplayer2 $rand(15,30) }
    if (%randir >= 60) && (%randir < 77) { msg $1 $2 $+ 's grenade floats through the air and turns $3 into mince meat, $2 was standing way to close and got alot of damage | hdec health %currentplayer 100 | hdec health %currentplayer2 $rand(50,80) }
    if (%randir >= 77) && (%randir < 80) { msg $1 there is a big tussle between $2 and $3 $+ , a grenade falls out of $2 $+ 's pocket and blows them both up | hdec health %currentplayer 100 | hdec health %currentplayer2 100 }
    if (%randir >= 80) && (%randir < 90) { msg $1 both $2 and $3 miss, improve your stats! }
    if (%randir >= 90) && (%randir <= 100) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does medium damage to $2 | hdec health %currentplayer2 $rand(40,60) }
  }
  if (%attack = 0) && (%backfire > 0) {
    if (%backfire < 20) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does medium damage to $2 | hdec health %currentplayer2 $rand(40,60) }
    if (%backfire >= 20) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does medium damage to $2 | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 2) { msg $1 $2 hits $3 with the grenade and causes quite a lot of damage | hdec health %currentplayer $rand(40,60) }
      if (%randir == 3) { msg $1 both $2 and $3 miss, im dissapointed :[ }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 65) { msg $1 $2 $+ 's grenade floats through the air and blows $3 up | hdec health %currentplayer 100 }
        else { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a small ammount of damage | hdec health %currentplayer2 $rand(15,30) }
      }
    }
  }
  if (%attack = 0) && (%backfire < 0) {
    if (%backfire > -20) { msg $1 $2 $+ 's grenade misses, $3 shoots back and does medium damage to $2 | hdec health %currentplayer2 $rand(30,60) }
    if (%backfire <= -20) && (%randir < 40) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 throws a grenade at $3 and does some damage but $3 gets off a lucky shot and hits $2 right in the chest | hdec health %currentplayer $rand(15,30) | hdec health %currentplayer2 $rand(60,80) }
      if (%randir == 2) { msg $1 $2 completely missed $3 with the grenade, $3 has time to aim and hit $2 square on doing big damage | hdec health %currentplayer2 $rand(60,80) }
      if (%randir == 3) { msg $1 $2 manages to hit $3 with the grenade but $3 is too fast and kills $2 | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 100 }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 65) { msg $1 $2 must feel so lucky, they managed to make an almost impossible throw and blows $3 into pieces | hdec health %currentplayer 100 }
        if (%randir >= 65) && (%randir < 70) { msg $1 $2 sneaks behind $3 and pulls one of the pins on their grenade RIP $2 | hdec health %currentplayer2 100 }
        else { msg $1 $2 throws a grenade at $3 and does some nice damage | hdec health %currentplayer $rand(40,60) }
      }
    }
    if (%backfire >= 40) { msg $1 $3 sneaks behind $2 as they are about to blow someone up and shoots them full of holes | hdec health %currentplayer2 100 }
  }
  if (%attack > 0) && (%backfire = 0) {
    if (%attack < 10) { 
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 misses $3 with a grenade and $3 misses $2 $+ . i think you guys need some target practice }
      if (%randir == 2) { msg $1 $2 $+ 's grenade misses, $3 shoots $2 and does a medium ammount of damage | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 3) { msg $1 $2 does quite alot of damage to $3 with his grenade | hdec health %currentplayer $rand(40,60) }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 60) && (%randir < 65) { msg $1 $2 throws the grenade, $3 tries to run away but is no match for $2 | hdec health %currentplayer 100 }
        if (%randir >= 65) && (%randir < 70) { msg $1 $2 has an unlucky throw a bird catches it and brings it back to him, RIP $2 | hdec health %currentplayer2 100 }
        else { msg $1 $2 does quite alot of damage to $2 with his grenade, $3 manages to get a shot of and does some small damage to $2 | hdec health %currentplayer $rand(40,60) | hdec health %currentplayer2 $rand(15,30) }
      }
    }
    if (%attack >= 10) && (%attack < 40) { msg $1 $2 throws a grenade at $3 $+ , the shrapnal flies at $3 delivering huge damage | hdec health %currentplayer $rand(50,80) }
    if (%attack >= 40) && (%attack < 60) { msg $1 $2 throws a grenade at $3 $+ , the shrapnal flies at $3 delivering huge damage | hdec health %currentplayer $rand(60,80) }
    if (%attack >= 60) { msg $1 $2 throws the grenade, $3 tries to run away but is no match for $2 | hdec health %currentplayer 100 }
  }
  if (%attack < 0) && (%backfire = 0) {
    if (%attack > -10) { msg $1 $2 and $3 miss each other, come on your meant to be killers! }
    if (%attack <= -10) && (%attack > -40) { msg $1 $2 $+ 's grenade misses, $3 manages to get a nice shot and does some good damage | hdec health %currentplayer2 $rand(40,60) }
    if (%attack <= -40) {
      set %randir $rand(1,4)
      if (%randir == 1) { msg $1 $2 $+ 's grenade misses, $3 manages to get a nice shot and does some good damage | hdec health %currentplayer2 $rand(40,60) }
      if (%randir == 2) { msg $1 $2 $+ 's grenade misses, $3 takes the oppotunity and deals a lot of damage to $2 | hdec health %currentplayer2 $rand(50,90) }
      if (%randir == 3) {
        set %randir $rand(1,100)
        if (%randir >= 40) && (%randir < 80) { msg $1 $2 this just isn't your day, you shouldn't attack people who are stronger than you! | hdec health %currentplayer2 100 }
        else { msg $1 $2 $+ 's grenade misses, $3 takes the oppotunity and deals a lot of damage to $2 | hdec health %currentplayer2 $rand(50,90) }
      }
      if (%randir == 4) { 
        set %randir $rand(1,100)
        if (%randir >= 40) && (%randir < 70) { msg $1 RIP $2 you got pwnd by a master ;] | hdec health %currentplayer2 100 }
        else { msg $1 $2 misses $3 with the grenade, $3 shoots $2 and does a lot of damage | hdec health %currentplayer2 $rand(60,90) }
      }
    }
  }
  /checkdead $1 $2 $3
}
alias checkdead {
  if ($hget(health, %currentplayer) <= 0) { 
    if ($hget(health, %currentplayer2) > 0) {
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Shotgun ] ] ] ] == on) { hinc money %currentplayer2 10000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Grenades ] ] ] ] == on) { hinc money %currentplayer2 20000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Helmet ] ] ] ] == on) { hinc money %currentplayer2 10000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Armour ] ] ] ] == on) { hinc money %currentplayer2 30000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ AK47 ] ] ] ] == on) { hinc money %currentplayer2 35000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ MotorBike ] ] ] ] == on) { hinc money %currentplayer2 45000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Sniper ] ] ] ] == on) { hinc money %currentplayer2 60000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ House ] ] ] ] == on) { hinc money %currentplayer2 80000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Guards ] ] ] ] == 1) { hinc money %currentplayer2 20000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Guards ] ] ] ] == 2) { hinc money %currentplayer2 40000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Guards ] ] ] ] == 3) { hinc money %currentplayer2 60000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Fortress ] ] ] ] == on) { hinc money %currentplayer2 100000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ RPG ] ] ] ] == on) { hinc money %currentplayer2 70000 }
      if ([ % [ $+ [ %currentplayer ] [ $+ [ Mortar ] ] ] ] == on) { hinc money %currentplayer2 80000 }
      hinc money %currentplayer2 $hget(money, %currentplayer)
      hinc attack %currentplayer2 5
      msg $1 $2 gained money from $3 and 5 attack for the kill!
    }
    msg $1 $3 was killed and removed from the game
    /mode $1 -v $3
    /hdel -w health %currentplayer
    /hdel -w defence %currentplayer
    /hdel -w attack %currentplayer
    /hdel -w money %currentplayer
    unset % [ $+ [ %currentplayer ] [ $+ [ Shotgun ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Grenades ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Helmet ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Armour ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ AK47 ] ] ] ]
    unset % [ $+ [ %currentplayer ] [ $+ [ MotorBike ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Sniper ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ House ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Guards ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Fortress ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ RPG ] ] ] 
    unset % [ $+ [ %currentplayer ] [ $+ [ Mortar ] ] ] 
    unset %kill [ $+ [ $3 ] ]
    set %count 1
    while (%count <= %top) {
      if ([ %player [ $+ [ %count ] ] ] == $3) {
        set [ %player [ $+ [ %count ] ] ] [ %player [ $+ [ %top ] ] ]
        unset %player [ $+ [ %top ] ]  
      }
      set %count $calc(%count + 1)
    }
    set %top $calc(%top - 1)
  }
  if ($hget(health, %currentplayer2) <= 0) { 
    if ($hget(health, %currentplayer) > 0) {
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Shotgun ] ] ] ] == on) { hinc money %currentplayer 10000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Grenades ] ] ] ] == on) { hinc money %currentplayer 20000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Helmet ] ] ] ] == on) { hinc money %currentplayer 10000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Armour ] ] ] ] == on) { hinc money %currentplayer 30000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ AK47 ] ] ] ] == on) { hinc money %currentplayer 35000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ MotorBike ] ] ] ] == on) { hinc money %currentplayer 45000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Sniper ] ] ] ] == on) { hinc money %currentplayer 60000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ House ] ] ] ] == on) { hinc money %currentplayer 80000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Guards ] ] ] ] == 1) { hinc money %currentplayer 20000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Guards ] ] ] ] == 2) { hinc money %currentplayer 40000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Guards ] ] ] ] == 3) { hinc money %currentplayer 60000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Fortress ] ] ] ] == on) { hinc money %currentplayer 100000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ RPG ] ] ] ] == on) { hinc money %currentplayer 70000 }
      if ([ % [ $+ [ %currentplayer2 ] [ $+ [ Mortar ] ] ] ] == on) { hinc money %currentplayer 80000 }
      hinc money %currentplayer $hget(money, %currentplayer2)
      hinc attack %currentplayer 5
      msg $1 $3 gained money from $2 and 5 attack for the kill!
    }
    msg $1 $2 was killed and removed from the game
    /mode $1 -v $2
    /hdel -w health %currentplayer2 
    /hdel -w defence %currentplayer2
    /hdel -w attack %currentplayer2
    /hdel -w money %currentplayer2 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Shotgun ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Grenades ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Helmet ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Armour ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ AK47 ] ] ] ]
    unset % [ $+ [ %currentplayer2 ] [ $+ [ MotorBike ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Sniper ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ House ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Guards ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Fortress ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ RPG ] ] ] 
    unset % [ $+ [ %currentplayer2 ] [ $+ [ Mortar ] ] ] 
    unset %kill [ $+ [ $2 ] ]
    set %count 1
    while (%count <= %top) {
      if ([ %player [ $+ [ %count ] ] ] == $2) {
        set [ %player [ $+ [ %count ] ] ] [ %player [ $+ [ %top ] ] ] 
        unset %player [ $+ [ %top ] ]
      }
      set %count $calc(%count + 1)
    }
    set %top $calc(%top - 1)
  }
  if (%top == 0) {
    msg $1 It was a draw!
    /mode $1 -m
    /goff $1
  }
  else if (%top < 2) {
    msg $1 %player1 has won the game 
    /mode $1 -m
    /highscores $1 %player1
    /mode $1 -v %player1
    /goff $1
  }
}
alias highscores {
  if (!%hightop) { set %hightop 0 }
  set %count 1
  while (%count <= %hightop) {
    if (%high [ $+ [ %count ] ] == $2) {
      set %in on 
    }
    set %count $calc(%count + 1)
  }
  if (%in == on) { 
    set %high [ $+ [ $2 ] ] $calc(%high [ $+ [ $2 ] ] + 1)
    /highscoreout
  }
  if (%in != on && %hightop < 20) { 
    set %hightop $calc(%hightop + 1)
    set [ %high [ $+ [ %hightop ] ] ] $2 
    set [ %high [ $+ [ $2 ] ] ] $calc(%high [ $+ [ $2 ] ] + 1)
    /highscoreout
  }
  if (%in != on && %hightop > 20) { msg %chan Sorry $2 but the high scores list is full | /highscoreout }
  unset %in
}
alias highscoreout {
  set %count 1
  set %highest %high1
  set %highest2 %high2
  set %highest3 %high3
  while (%count <= %hightop) {
    if ([ %high [ $+ [ %high [ $+ [ %count ] ] ] ] ] > [ %high [ $+ [ %high  $+ [ %highest ] ] ] ] || [ %high [ $+ [ %count ] ] ] == %highest) {
      set %highest [ %high [ $+ [ %count ] ] ] 
      set %highestwin [ %high [ $+ [ %high [ $+ [ %count ] ] ] ] ] 
    }
    set %count $calc(%count + 1)
  } 
  set %count 1
  while (%count <= %hightop) {
    if ([ %high [ $+ [ %high [ $+ [ %count ] ] ] ] ] > [ %high [ $+ [ %high  $+ [ %highest2 ] ] ] ] || [ %high [ $+ [ %count ] ] ] == %highest2) {
      if ([ %high [ $+ [ %count ] ] ] != %highest) {
        set %highest2 [ %high [ $+ [ %count ] ] ] 
        set %highest2win [ %high [ $+ [ %high [ $+ [ %count ] ] ] ] ] 
      }
    }
    set %count $calc(%count + 1)
  } 
  set %count 1
  while (%count <= %hightop) {
    if ([ %high [ $+ [ %high [ $+ [ %count ] ] ] ] ] > [ %high [ $+ [ %high  $+ [ %highest3 ] ] ] ] || [ %high [ $+ [ %count ] ] ] == %highest3) {
      if ([ %high [ $+ [ %count ] ] ] != %highest && [ %high [ $+ [ %count ] ] ] != %highest2) {
        set %highest3 [ %high [ $+ [ %count ] ] ] 
        set %highest3win [ %high [ $+ [ %high [ $+ [ %count ] ] ] ] ]
      }
    }
    set %count $calc(%count + 1)
  }
  /cs topic %chan 14LAST MAN STANDING - 4No Spamming -_- 14- For help type 4!Commands 14in Zach's pm 14#14 %highest 14Wins:4 %highestwin 14#24 %highest2 14Wins:4 %highest2win 14#34 %highest3 14Wins:4 %highest3win 14 Last winner4 %player1  
}
alias goff {
  unset %stopper
  unset %started
  unset %gameon 
  unset %round
  unset %currentplayer
  unset %currentplayer2
  unset %randir 
  unset %ohyes
  unset %roundnum
  unset %pmnick
  set %count 1
  while (%count <= %top) { 
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] ]
    unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] ]
    unset [ %kill [ $+ [ %player [ $+ [ %count ] ] ] ]
    /hdel -w health [ %player [ $+ [ %count ] ] ]
    /hdel -w money [ %player [ $+ [ %count ] ] ]
    /hdel -w defence [ %player [ $+ [ %count ] ] ]
    /hdel -w attack [ %player [ $+ [ %count ] ] ] 
    unset %player [ $+ [ %count ] ] ]  
    set %count $calc(%count + 1)
  }
  unset %count
  unset %top 
  /timers off
  /mode $1 -m
}
on *:KICK:%chan:{
  set %count 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $knick) {
      unset [ %kill [ $+ [ %player [ $+ [ %count ] ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      /hdel -w health [ %player [ $+ [ %count ] ] ]
      /hdel -w money [ %player [ $+ [ %count ] ] ]
      /hdel -w defence [ %player [ $+ [ %count ] ] ]
      /hdel -w attack [ %player [ $+ [ %count ] ] ]  
      set [ %player [ $+ [ %count ] ] ] %player [ $+ [ %top ] ]
      unset %player [ $+ [ %top ] ] 
      set %top $calc(%top - 1)
      msg $chan $knick has been removed from the game.
    }
    set %count $calc(%count + 1)
  }
  if (%top < 2) {
    if (%gameon == on) {
      msg %chan %player1 has won the game 
      /mode %chan -m
      /highscores %chan %player1
      /mode %chan -v %player1
      /goff %chan
    }
  }

}
on *:PART:%chan: { 
  set %count 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $nick) {
      unset [ %kill [ $+ [ %player [ $+ [ %count ] ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      /hdel -w health [ %player [ $+ [ %count ] ] ]
      /hdel -w money [ %player [ $+ [ %count ] ] ]
      /hdel -w defence [ %player [ $+ [ %count ] ] ]
      /hdel -w attack [ %player [ $+ [ %count ] ] ]  
      set [ %player [ $+ [ %count ] ] ] %player [ $+ [ %top ] ]
      unset %player [ $+ [ %top ] ] 
      set %top $calc(%top - 1)
      msg $chan $nick has been removed from the game.
    }
    set %count $calc(%count + 1)
  }
  if (%top < 2) {
    if (%gameon == on) {
      msg %chan %player1 has won the game 
      /mode %chan -m
      /highscores %chan %player1
      /mode %chan -v %player1
      /goff %chan
    }
  }
}
on *:NICK:{
  var %count = 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $nick) {
      /hadd -m health $newnick $hget(health, $nick)
      /hadd -m money $newnick $hget(money, $nick)
      /hadd -m defence $newnick $hget(defence, $nick)
      /hadd -m attack $newnick $hget(attack, $nick)
      /hdel -w health [ %player [ $+ [ %count ] ] ]
      /hdel -w money [ %player [ $+ [ %count ] ] ]
      /hdel -w defence [ %player [ $+ [ %count ] ] ]
      /hdel -w attack [ %player [ $+ [ %count ] ] ]
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] on
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] on
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] on
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] on
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      if (% [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] == on) {
        set [ %player [ $+ [ %count ] ] ] $newnick 
        set % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] on 
        set [ %player [ $+ [ %count ] ] ] $nick 
      }
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ] 
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] ]
      if ([ %kill [ $+ [ $nick ] ] ] == on) {
        set %kill [ $+ [ $newnick ] ]
      }
      unset %kill [ $+ [ $nick ] ]
      set [ %player [ $+ [ %count ] ] ] $newnick
    }
    set %count $calc(%count + 1)
  }
}
on *:QUIT: {
  var %count = 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $nick) {
      unset [ %kill [ $+ [ %player [ $+ [ %count ] ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Shotgun ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Grenades ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Helmet ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Armour ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ AK47 ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ MotorBike ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Sniper ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ House ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Guards ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Fortress ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ RPG ] ] ]
      unset % [ $+ [ %player [ $+ [ %count ] ] ] ] [ $+ [ Mortar ] ] ]
      /hdel -w health [ %player [ $+ [ %count ] ] ]
      /hdel -w money [ %player [ $+ [ %count ] ] ]
      /hdel -w defence [ %player [ $+ [ %count ] ] ]
      /hdel -w attack [ %player [ $+ [ %count ] ] ]
      set [ %player [ $+ [ %count ] ] ] [ %player [ $+ [ %top ] ] ]
      unset %player [ $+ [ %top ] ] 
      set %top $calc(%top - 1)
    }
    set %count $calc(%count + 1)
  }
  if (%top < 2) {
    if (%gameon == on) {
      msg %chan %player1 has won the game 
      /mode %chan -m
      /highscores %chan %player1
      /mode %chan -v %player1
      /goff %chan
    }
  }
}
on *:open:?:{
  set %count 1
  while (%count <= %top) {
    if ([ %player [ $+ [ %count ] ] ] == $nick) {
      set %ohyes on
      set %pmnick [ %player [ $+ [ %count ] ] ]
    }
    set %count $calc(%count + 1)
  }
  if ($1 == !money) {
    if (%ohyes == on) { msg $nick Money: € $+ $hget(money, %pmnick) $+ }
    else { msg $nick $nick you're not playing } 
  }
  if ($1 == !stats) {
    if (%ohyes == on) {
      msg $nick Health: $hget(health, %pmnick) $+ %
      msg $nick Attack: $hget(attack, %pmnick) 
      msg $nick Defence: $hget(defence, %pmnick) 
    }
    else { msg $nick $nick you're not playing }
  }
  if ($1 == !shop) {
    msg $nick Welcome To The Last Man Standing Shop
    msg $nick ------------------------------------------------------
    msg $nick These are the items that you can purchase
    msg $nick Health (25%): €20,000 (type !health 25) - Health (50%): €30,000 (type !health 50) - Shotgun: €10,000
    msg $nick Helmet: €10,000 - Grenades: €20,000 - Armour: €30,000 - AK47: €35,000
    msg $nick MotorBike: €45,000 - Sniper: €60,000 - House: €80,000 - Guards: €20,000 (per guard, max 3)
    msg $nick Fortress: €100,000 - Fortress Items: (RPG: €70,000 - Mortar: €80,000)
    msg $nick ------------------------------------------------------
    msg $nick For more information: !info (ITEM)
    msg $nick To buy: !buy (ITEM)
    msg $nick To sell for 90 $+ % of original cost: !sell (ITEM)
  }
  if ($1 == !info) {
    if ($2 == Shotgun) { msg $nick Shotgun adds 10 points to your attack. Costs €10,000 }
    if ($2 == Helmet) { msg $nick Helmet adds 10 points to your defence. Costs €10,000 }
    if ($2 == Grenades) { msg $nick Grenades don't add anything to your attack, they cause more damage but are less likely to hit. Type !grenade (nick) to use them on someone. Costs €20,000 }
    if ($2 == Armour) { msg $nick Armour adds 20 points to your defence. Costs €30,000 }
    if ($2 == AK47) { msg $nick AK47 adds 25 points to your attack. Costs €35,000 }
    if ($2 == MotorBike) { msg $nick MotorBike adds 30 points to your defence. Costs €45,000 }
    if ($2 == Sniper) { msg $nick Sniper adds 40 points to your attack. Costs €60,000 }
    if ($2 == House) { msg $nick House adds 55 points to your defence. Costs €80,000 }
    if ($2 == Guards) { msg $nick Guards add 10 points to your defence and 10 to attack, per guard, the maximum ammount you can have is 3. Costs €20,000 }
    if ($2 == Fortress) { msg $nick Fortress give you some serious protection and adds 80 points to your defence. Costs €100,000 }
    if ($2 == RPG) { msg $nick RPG can only be bought once you own a fortress, adds 60 points to your attack. Costs €70,000 }
    if ($2 == Mortar) { msg $nick Mortar can only be bought once you own a fortress, adds 70 points to your attack. Costs €80,000 }
  }
  if ($1 == !buy) {
    if (%ohyes != on) { /window -c $nick | halt }
    if ($2 == Health) {
      if ($3 == 25) {
        if ($hget(money, %pmnick) < 20000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          /hdec money %pmnick 20000
          /hinc health %pmnick 25
          msg $nick You bought 25 units of Health!
        }
      }
      if ($3 == 50) {
        if ($hget(money, %pmnick) < 30000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          /hdec money %pmnick 30000
          /hinc health %pmnick 50
          msg $nick You bought 50 units of Health!
        }
      }
    }
    if ($2 == Shotgun) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Shotgun ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 10000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Shotgun ] ] ] ] on
          /hdec money %pmnick 10000
          /hinc attack %pmnick 10
          msg $nick You bought the Shotgun!
        }
      }
    }
    if ($2 == Helmet) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Helmet ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 10000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Helmet ] ] ] ] on
          /hdec money %pmnick 10000
          /hinc defence %pmnick 10
          msg $nick You bought the Helmet!
        }
      }
    }
    if ($2 == Grenades) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Grenades ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 20000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Grenades ] ] ] ] on
          /hdec money %pmnick 20000
          msg $nick You bought Grenades!
        }
      }
    }
    if ($2 == Armour) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Armour ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 30000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Armour ] ] ] ] on
          /hdec money %pmnick 30000
          /hinc defence %pmnick 20
          msg $nick You bought some Armour!
        }
      }
    }
    if ($2 == AK47) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ AK47 ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 35000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ AK47 ] ] ] ] on
          /hdec money %pmnick 35000
          /hinc attack %pmnick 25
          msg $nick You bought the AK47!
        }
      }
    }
    if ($2 == MotorBike) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ MotorBike ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 45000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ MotorBike ] ] ] ] on
          /hdec money %pmnick 45000
          /hinc defence %pmnick 30
          msg $nick You bought a MotorBike!
        }
      }
    }
    if ($2 == Sniper) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Sniper ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 60000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Sniper ] ] ] ] on
          /hdec money %pmnick 60000
          /hinc attack %pmnick 40
          msg $nick You bought the Sniper!
        }
      }
    }
    if ($2 == House) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ House ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 80000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ House ] ] ] ] on
          /hdec money %pmnick 80000
          /hinc defence %pmnick 55
          msg $nick You bought a House!
        }
      }
    }
    if ($2 == Guards) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Guards ] ] ] ] == 3) { msg $nick You already have the max ammount of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 20000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Guards ] ] ] ] $calc(% [ $+ [ %pmnick ] [ $+ [ Guards ] ] ] + 1)
          /hdec money %pmnick 20000
          /hinc attack %pmnick 10
          /hinc defence %pmnick 10
          msg $nick You bought a Guard!
        }
      }
    }
    if ($2 == Fortress) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ($hget(money, %pmnick) < 100000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] ] on
          /hdec money %pmnick 100000
          /hinc defence %pmnick 80
          msg $nick You bought the Fortress!
        }
      }
    }
    if ($2 == RPG) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ RPG ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ([ % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] ] != on) { msg $nick You need to own the Fortress first | unset %ohyes | /window -c $nick | halt }
        else if ($hget(money, %pmnick) < 70000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ RPG ] ] ] ] on
          /hdec money %pmnick 70000
          /hinc attack %pmnick 60
          msg $nick You bought the RPG!
        }
      }
    }
    if ($2 == Mortar) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Mortar ] ] ] ] == on) { msg $nick You already have one of these | unset %ohyes | /window -c $nick | halt }
      else {
        if ([ % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] ] != on) { msg $nick You need to own the Fortress first | unset %ohyes | /window -c $nick | halt }
        else if ($hget(money, %pmnick) < 80000) { msg $nick Sorry you don't have enough money | unset %ohyes | /window -c $nick | halt }
        else {
          set [ % [ $+ [ %pmnick ] [ $+ [ Mortar ] ] ] ] on
          /hdec money %pmnick 80000
          /hinc attack %pmnick 70
          msg $nick You bought the Mortar!
        }
      }
    }
  }
  if ($1 == !sell) {
    if (%ohyes != on) { /window -c $nick | halt }
    if ($2 == health) { msg $nick Sorry you can't sell your own health you suicidial moron! | unset %ohyes | /window -c $nick | halt }
    if ($2 == Shotgun) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Shotgun ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Shotgun ] ] ] 
        /hinc money %pmnick 9000
        /hdec attack %pmnick 10
        msg $nick You sold your Shotgun
      }
    }
    if ($2 == Helmet) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Helmet ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Helmet ] ] ] 
        /hinc money %pmnick 9000
        /hdec defence %pmnick 10
        msg $nick You sold your Helmet!
      }
    }
    if ($2 == Grenades) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Grenades ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Grenades ] ] ]
        /hinc money %pmnick 18000
        msg $nick You sold your Grenades!
      }
    }
    if ($2 == Armour) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Armour ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Armour ] ] ]
        /hinc money %pmnick 27000
        /hdec defence %pmnick 20
        msg $nick You sold your Armour!
      }
    }
    if ($2 == AK47) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ AK47 ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ AK47 ] ] ]
        /hinc money %pmnick 31500
        /hdec attack %pmnick 25
        msg $nick You sold your AK47!
      }
    }
    if ($2 == MotorBike) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ MotorBike ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ MotorBike ] ] ]
        /hinc money %pmnick 40500
        /hdec defence %pmnick 30
        msg $nick You sold your MotorBike!       
      }
    }
    if ($2 == Sniper) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Sniper ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Sniper ] ] ]
        /hinc money %pmnick 54000
        /hdec attack %pmnick 40
        msg $nick You sold your Sniper!
      }
    }
    if ($2 == House) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ House ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ House ] ] ]
        /hinc money %pmnick 72000
        /hdec defence %pmnick 55
        msg $nick You sold your House!
      }
    }
    if ($2 == Guards) {
      msg $nick You cannot sell guards
    }
    if ($2 == Fortress) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      if ([ % [ $+ [ %pmnick ] [ $+ [ RPG ] ] ] ] == on) { msg $nick You have to sell your RPG first | unset %ohyes | /window -c $nick | halt }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Mortar ] ] ] ] == on) { msg $nick You have to sell your Mortar first | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] 
        /hinc money %pmnick 90000
        /hdec defence %pmnick 80
        msg $nick You sold your Fortress!
      }
    }
    if ($2 == RPG) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ RPG ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ RPG ] ] ]
        /hinc money %pmnick 63000
        /hdec attack %pmnick 60
        msg $nick You sold your RPG!
      }
    }
    if ($2 == Mortar) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Mortar ] ] ] ] != on) { msg $nick You don't have this item | unset %ohyes | /window -c $nick | halt }
      else {
        unset % [ $+ [ %pmnick ] [ $+ [ Mortar ] ] ]
        /hinc money %pmnick 72000
        /hdec attack %pmnick 70
        msg $nick You sold your Mortar
      }
    }
  }
  if ($1 == !items) {
    if (%ohyes == on) {
      if ([ % [ $+ [ %pmnick ] [ $+ [ Shotgun ] ] ] ] == on) { var %shotgun = Shotgun }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Grenades ] ] ] ] == on) { var %grenades = grenades }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Helmet ] ] ] ] == on) { var %helmet = Helmet }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Armour ] ] ] ] == on) { var %armour = Armour }
      if ([ % [ $+ [ %pmnick ] [ $+ [ AK47 ] ] ] ] == on) { var %ak47 = AK47 }
      if ([ % [ $+ [ %pmnick ] [ $+ [ MotorBike ] ] ] ] == on) { var %motor = MotorBike }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Sniper ] ] ] ] == on) { var %sniper = Sniper }
      if ([ % [ $+ [ %pmnick ] [ $+ [ House ] ] ] ] == on) { var %house = House }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Guards ] ] ] ] == 1) { var %guards = 1 Guard }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Guards ] ] ] ] == 2) { var %guards = 2 Guards }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Guards ] ] ] ] == 3) { var %guards = 3 Guards }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Fortress ] ] ] ] == on) { var %fortress = Fortress }
      if ([ % [ $+ [ %pmnick ] [ $+ [ RPG ] ] ] ] == on) { var %RPG = RPG }
      if ([ % [ $+ [ %pmnick ] [ $+ [ Mortar ] ] ] ] == on) { var %mortar = Mortar }
      msg $nick You own: %shotgun %grenades %helmet %armour %ak47 %motor %sniper %house %guards %fortress %RPG %mortar
    }
  }
  if ($1 == !commands || $1 == !help) {
    msg $nick The aim of the game is to be the last player alive, to do this you need to buy items from the shop in pm. To start the game type !start and !join to join.
    msg $nick Type !shop to view the shop or look here: http://pastebin.com/bjUXxkTU for information about the items type !info (Item name), to buy items type !buy (Item name), to sell !sell (Item name). To view your money, your stats or which items you have type !money, !stats or !items.
    msg $nick To actually kill a player in the game you have to use !shoot (nick) or !grenade once you own these, this command is done in the main channel, when you kill you gain 5 attack points and the players money. each player can only be shot once per round but can shoot as many times as they want. 
    msg $nick Each round you gain money at the end which will help you to buy more things. At any point during the game the owner of the bot can type !off to turn it off.
    msg $nick Spammers will be kicked from the channel or devoiced if playing.
  }
  if ($1 == !opme) {
    if ($address($nick, 2) == %owner) { /mode %chan +o $nick }
  }
  unset %ohyes 
  /window -c $nick 
}
on *:text:!Commands*:%chan: {
  msg $nick The aim of the game is to be the last player alive, to do this you need to buy items from the shop in pm. To start the game type !start and !join to join.
  msg $nick Type !shop to view the shop or look here: http://pastebin.com/bjUXxkTU for information about the items type !info (Item name), to buy items type !buy (Item name), to sell !sell (Item name). To view your money, your stats or which items you have type !money, !stats or !items.
  msg $nick To actually kill a player in the game you have to use !shoot (nick) or !grenade once you own these, this command is done in the main channel, when you kill you gain 5 attack points and the players money. each player can only be shot once per round but can shoot as many times as they want. 
  msg $nick Each round you gain money at the end which will help you to buy more things. At any point during the game the owner of the bot can type !off to turn it off.
  msg $nick Spammers will be kicked from the channel or devoiced if playing.
  /window -c $nick 
}
on *:TEXT:*:%chan:{
  if ($address($nick, 2) == %owner) { halt }
  inc -u4 %spam. [ $+ [ $nick ] ]
  if (%spam. [ $+ [ $nick ] ] == 6) {
    if (%gameon == on) {
      /mode # -v $nick
      /msg $chan stop spamming $nick now you have to wait till next time to shoot 
      unset %spam. [ $+ [ $nick ] ]
    }
    else { /cs kickban # $nick | unset %spam. [ $+ [ $nick ] ] }
  }
}

Comments

Sign in to comment.
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.