Heckler and Koch 9mm submachinegun with suppressor

A submachine gun that tracks ammo usage.

Author: Valthonis@TinyTIM
Category: Combat
Functions: get(), le(), owner(), rand(), sub(), v().
Compatibility: TinyTIM.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Heckler and Koch 9mm submachinegun with suppressor

@create HK MP5SD
@desc HK MP5SD=A Heckler & Koch 9mm submachinegun with suppressor. The SMG appears somewhat worn from use, but well maintained nonetheless.
End of decompile.
@set HK MP5SD=X
@sex HK MP5SD=Submachinegun
@taste HK MP5SD=Tastes like gun oil. Ewwwww.
@succ HK MP5SD=You pick up an HK MP5SD. It feels hefty and powerful in your hands.
@osucc HK MP5SD=picks up %p MP5 and checks the clip, sights, etc. before stowing it.
@asucc HK MP5SD=@pemit here=>>You have [get(me/ammo)] rounds remaining.<<
@fail HK MP5SD=>>ACCESS DENIED<<
@ofail HK MP5SD=tries to pick up an MP5 that doesn't belong to %o. It refuses to work in %p hands, so %s drops it.
@va HK MP5SD=$mphelp:@pemit here=HK MP5SD Commands;@pemit here=PULLMP pulls out the MP5.;@pemit here=FIRE fires the MP5.;@pemit here=SHOOT <target> shoots a three-round burst at someone/thing.;@pemit here=WASTE <target> shoots and kills your target. (Will not work in HAVENs);@pemit here=RELOADMP reloads the MP5.;@pemit here=STOWMP puts the MP5 away.;@pemit here=CHECKMP checks the MP5 for ammo, jammed slides, etc.
@vb HK MP5SD=$pullmp:@switch %#=owner(me),{@force here=:pulls an MP5 out of %p coat and flicks off the safety.}
@vc HK MP5SD=$fire:@switch %#=owner(me),{@force here=:fires %p MP5, spraying bullets wildly around the room.;@ammo me = [SUB(v(ammo),v(xa))];@xa me=rand(v(ammo))}
@vd HK MP5SD=$shoot *:@if LE([get(me/ammo)],0)={@pemit here=>>You're empty. Reload.<<},{@switch %#=owner(me),{@force here=:fires a burst from the MP5 at %0.;@ammo me = [SUB(get(me/ammo),3)]}}
@ve HK MP5SD=$waste *:@switch %#=owner(me),{@force here=:shoots %0 with the MP5! %0 drops to the floor, bleeding profusely.;@force here=kill %0=100;@ammo me=[SUB(get(me/ammo),15)]}
@vf HK MP5SD=$stowmp:@switch %#=owner(me),{@force here=:flicks the safety back on and hides %p MP5 back under %p coat.}
@vg HK MP5SD=$checkmp:@pemit here=HK MP5SD Fully Functional;@if LE([get(me/ammo)],0)={@pemit here=>>Clip Empty<<},{@pemit here=>>You have [get(me/ammo)] rounds remaining.<<}
@vh HK MP5SD=$reloadmp:@if LE([get(me/ammo),0)={@switch %#=owner(me),{@force here=:discards %p empty ammo clip and reloads %p MP5, bringing 15 new rounds of shiny, pointy death into play.;@ammo me = 15}},{@pemit here=>>You're not empty. [get(me/ammo)] rounds remaining.<<}
@vz HK MP5SD=15
@alias HK MP5SD/vz=ammo
@xa HK MP5SD=2