Actor MP5 : Weapon
{
  Obituary "%o was gunned down by %k's MP5."
  Weapon.SelectionOrder 1100  
  Inventory.PickupMessage "You got the MP5 submachine gun!"
  weapon.ammotype "MP5Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "MP5Ammo"
  states
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    MP5K A 1 A_WeaponReady
    loop
  Deselect:
    MP5K A 0 A_Lower
    MP5K A 0 A_Lower
    MP5K A 1 A_Lower
    Loop
  Select:
    MP5K A 0 A_Raise
    MP5K A 0 A_Raise
    MP5K A 1 A_Raise
    Loop
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    MP5K A 0 A_jumpifinventory("Doubletap",1,"Fire_doubletap")
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 2 Bright A_FireBullets(3.6, 3.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 2 Bright A_FireBullets (3.6, 3.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Fire_deadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifinventory("Doubletap",1,"Fire_doubletapdeadshot")
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 2 Bright A_FireBullets(1.3, 1.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 2 Bright A_FireBullets (1.3, 1.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Fire_doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 1 Bright A_FireBullets(1.3, 1.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 1 Bright A_FireBullets (1.3, 1.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Fire_doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 1 Bright A_FireBullets(3.6, 3.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 1 Bright A_FireBullets (3.6, 3.6, -1, random(900,900), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Reload:	
    PIRE A 0 A_takeinventory("IsReloading",1)
    MP5K A 0 A_jumpifinventory("Speedcola",1,"Reload_speed")
    MKRE A 0 A_jumpifinventory("MP5clip",30,"ready")
    MKRE A 0 A_jumpifinventory("MP5ammo",1,1)
	goto ready+1
	MKRE A 0 A_playsound("MP5/clipout")
	MKRE ABCD 2
	MKRE D 30
    goto reload2
  Reload2:
    MKRE D 0 A_Giveinventory("MP5clip",1)
    MKRE D 0 A_Takeinventory("MP5ammo",1)
    MKRE D 0 A_jumpifinventory("MP5clip",30,"Reloaddone")
    MKRE D 0 A_jumpifinventory("MP5ammo",1,"Reload2")
	goto Reloaddone
  Reloaddone:
    MKRE D 0 A_playsound("MP5/Clipin")
	MKRE D 15 
	MKRE D 0 A_playsound("MP5/Bolt")
	MKRE D 7
	MKRE DCBA 2
	goto ready
  Reload_speed:
    MKRE A 0 A_jumpifinventory("MP5clip",30,"ready")
    MKRE A 0 A_jumpifinventory("MP5ammo",1,1)
	goto ready+1
	MKRE A 0 A_playsound("MP5/clipout")
	MKRE ABCD 1
	MKRE D 15
    goto reload2_speed
  Reload2_speed:
    MKRE D 0 A_Giveinventory("MP5clip",1)
    MKRE D 0 A_Takeinventory("MP5ammo",1)
    MKRE D 0 A_jumpifinventory("MP5clip",30,"Reloaddone_speed")
    MKRE D 0 A_jumpifinventory("MP5ammo",1,"Reload2_speed")
	goto Reloaddone_speed
  Reloaddone_speed:
    MKRE D 0 A_playsound("MP5/Clipin")
	MKRE D 7
	MKRE D 0 A_playsound("MP5/Bolt")
	MKRE D 4
	MKRE DCBA 1
	goto ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Flash:
    TNT1 A 1
    stop
  Spawn:
    MP5I A -1
    stop
  }
}

actor MP5Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 30
    ammo.backpackamount 0
    ammo.backpackmaxamount 30
    +IGNORESKILL
}

Actor PAPMP5 : Weapon
{
  Obituary "%o was gunned down by %k's MP5."
  Inventory.PickupMessage "You got the MP5 submachine gun!"
  weapon.ammotype "PAPMP5Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  Weapon.SelectionOrder 1300  
  weapon.ammotype2 "PAPMP5Ammo"
  states
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    MP5K A 1 A_WeaponReady
    loop
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Deselect:
    MP5K A 0 A_Lower
    MP5K A 0 A_Lower
    MP5K A 1 A_Lower
    Loop
  Select:
    MP5K A 0 A_Raise
    MP5K A 0 A_Raise
    MP5K A 1 A_Raise
    Loop
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    MP5K A 0 A_jumpifinventory("Doubletap",1,"Fire_doubletap")
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 2 Bright A_FireBullets(1.6, 1.6, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 2 Bright A_FireBullets (1.6, 1.6, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Fire_deadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifinventory("Doubletap",1,"Fire_doubletapdeadshot")
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 2 Bright A_FireBullets(1, 1, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 2 Bright A_FireBullets (1, 1, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 2
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Fire_doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 1 Bright A_FireBullets(1, 1, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 1 Bright A_FireBullets (1, 1, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Fire_doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
	TNTT A 0 A_playsound("MP5/fire")
    MP5F A 1 Bright A_FireBullets(1.6, 1.6, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
	TNTT A 0 A_playsound("MP5/fire")
    MP5F B 1 Bright A_FireBullets (1.6, 1.6, -1, random(1800,1800), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    MP5K A 1
    MP5K A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	MP5K A 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    MP5K A 0 A_jumpifnoammo("Reload")
    goto Ready
  Reload:	
    PIRE A 0 A_takeinventory("IsReloading",1)
    MP5K A 0 A_jumpifinventory("Speedcola",1,"Reload_speed")
    MKRE A 0 A_jumpifinventory("PAPMP5clip",45,"ready")
    MKRE A 0 A_jumpifinventory("PAPMP5ammo",1,1)
	goto ready+1
	MKRE A 0 A_playsound("MP5/clipout")
	MKRE ABCD 2
	MKRE D 30
    goto reload2
  Reload2:
    MKRE D 0 A_Giveinventory("PAPMP5clip",1)
    MKRE D 0 A_Takeinventory("PAPMP5ammo",1)
    MKRE D 0 A_jumpifinventory("PAPMP5clip",45,"Reloaddone")
    MKRE D 0 A_jumpifinventory("PAPMP5ammo",1,"Reload2")
	goto Reloaddone
  Reloaddone:
    MKRE D 0 A_playsound("MP5/Clipin")
	MKRE D 15 
	MKRE D 0 A_playsound("MP5/Bolt")
	MKRE D 7
	MKRE DCBA 2
	goto ready
  Reload_speed:
    MKRE A 0 A_jumpifinventory("PAPMP5clip",45,"ready")
    MKRE A 0 A_jumpifinventory("PAPMP5ammo",1,1)
	goto ready+1
	MKRE A 0 A_playsound("MP5/clipout")
	MKRE ABCD 1
	MKRE D 15
    goto reload2_speed
  Reload2_speed:
    MKRE D 0 A_Giveinventory("PAPMP5clip",1)
    MKRE D 0 A_Takeinventory("PAPMP5ammo",1)
    MKRE D 0 A_jumpifinventory("PAPMP5clip",45,"Reloaddone_speed")
    MKRE D 0 A_jumpifinventory("PAPMP5ammo",1,"Reload2_speed")
	goto Reloaddone_speed
  Reloaddone_speed:
    MKRE D 0 A_playsound("MP5/Clipin")
	MKRE D 7
	MKRE D 0 A_playsound("MP5/Bolt")
	MKRE D 4
	MKRE DCBA 1
	goto ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Flash:
    TNT1 A 1
    stop
  Spawn:
    MP5I A -1
    stop
  }
}

actor PAPMP5Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 45
    ammo.backpackamount 0
    ammo.backpackmaxamount 45
    +IGNORESKILL
}

actor MP5Ammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 30
    inventory.maxamount 360
    ammo.backpackamount 30
    ammo.backpackmaxamount 360
    +IGNORESKILL
    inventory.pickupmessage "Got MP5 rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPMP5Ammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 30
    inventory.maxamount 450
    ammo.backpackamount 30
    ammo.backpackmaxamount 450
    +IGNORESKILL
    inventory.pickupmessage "Got MP5 rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}
