Condition SWEPs

Hi guys, this is mine and Kogitsune’s SWEP pack we were working on.
Started in 2009 February 22nd, stopped in next 3 days (because I sucked in LUA then) resumed in April 2nd, finished April 3rd, polished April 3rd and 4th.

[release]
Features:

  • Weapons’ condition (weapons jam and break)
  • Far Cry 2 - like running system
  • Dynamic accuracy system
  • Shell Ejection (since 1.6)
  • Weapons will also jam under-water (since 1.6)
  • Accuracy also depends on condition (the lower the condition, the lower the accuracy!)
  • 18 Both Custom Models and Default Valve’s Models.
  • A nice indicator above your ammo indicator which shows your weapon’s condition
  • Works perfectly both in Multiplayer and Singleplayer
  • Normal draw speed
  • Manual reload (Auto-reload is for babies :v:)

Usage:
Left click - shoot (obvious).
Right click - use ironsights OR if your weapon is broken to drop it.
Use + Right click - attach a silencer if available
Reload - reload or un-jam your weapon.

Requirements:
Counter-Strike: Source

FAQ:
Q: What is this? Another 5-second SWEP pack?
A: I don’t know what 5-second SWEPs mean, so I’ll say no.

Q: Hey, you’re not working on Tactical Weapons Pack anymore, why?!
A: Because CSE base is well, kinda outdated and I decided to write my own base, so you can call these SWEPs Tactical Weapons Pack Version 2.

Q: Okay, so what do I need for this to work?
A: Read everything above.

Q: Hey! My weapons won’t jam at all!
A: Weapons will start jamming after your weapon’s condition is lower than 30%.

Q: When my weapons break, I don’t want to drop them and remove them! Doing that will take alot of time for each broken weapon! Besides, if I won’t remove them and there will be alot of them it will lag my server!
A: Broken weapons will remove themselves after 15 seconds.

Q: Okay, so if I fire 30 bullets my weapon’s condition will go down from 100% to 90% or less?
A: No, for example, if you fire 30 bullets from AK-47 your weapon’s condition will go down from 100% to 98%.

** Q: Are there any custom models?**
A: Yes, since version 1.2 and up

Q: I found a bug! Where do I submit it?
A: Post it here.

*** How to install ***

  1. Extract the Condition SWEPs folder (Make sure there is no another Condition SWEPs folder inside the Condition SWEPs folder!)
  2. Copy-Paste it to your addons
  3. Have fun!

*** How to update***
** If there is an update, lets say for 1.5, and you’re installing for example 1.51, then do this **

  1. Go to your addons folder
  2. Go to your Condition SWEPs folder
  3. Find the lua folder, delete it
  4. Copy-Paste the new update into your updates folder (Make sure there is no another Condition SWEPs folder inside the Condition SWEPs folder!)
  5. Have fun!

** If there is an update which goes from 1.51 to lets say 1.6, then do this **

  1. Go to your addons folder
  2. Delete the Condition SWEPs folder
  3. Extract the new version somewhere (Make sure there is no another Condition SWEPs folder inside the Condition SWEPs folder!)
  4. Cut/Copy-Paste the new version to your addons folder
  5. Have fun!

Changelog:
1.61:

  • Added un-added spawnicons
    /\ Fixed Sig 552 using wrong base
    /\ Fixed AK-47 starting out at 30% condition
    /\ Fixed M3 Super90, XM1014, Aug A2 and Sig 552 having AK-47’s icons

1.6:

  • Added a Sig 552 (Custom and Default)
  • Added an Aug A2 (Custom and Default)
  • Added shell ejection (Custom and Default)
  • Added a nice head-bobbing effect when running
  • Un-jamming your weapon will now make a shell come out (Custom and Default)
  • Added bullet chambering (credits go to Night-hawk) (Custom and Default)
  • Weapons now jam underwater (so I guess it’s not broken :V) (Custom and Default)
    /\ Fixed a bug in one of bases that caused the weapon Condition indicator not to show up when you’re running (Custom)
    /\ Fixed MP5 having invalid position for ironsights when drawing/reloading (thanks to HWG for the idea) (Custom)
    /\ Updated/fixed the accuracy system - fixed an ironsights accuracy bug (Custom and Default)
    /\ 3 bases for default VALVe’s models now are based off bases for custom models, which decreases loading time a bit
    /\ Lowered recoil on AK-47 (Custom and Default)
    /\ Weapons now swing from side to side (when running) even more further
    And some other stuff I can’t remember

1.51:
/\ Updated the running system (Custom and Default)
/\ Fixed a running bug when you could hold down your running button, stand still and it would set your status to running (Custom and Default)
/\ Weapon now swings from side to side much further (Custom and Default)

1.5:

  • Added a XM1014 (Custom and Default)
  • Added a M3 Super90 (Custom and Default)
    /\ Fixed a bug when you could press your Run button, then change your weapon, stop deploy the same weapon and have the weapon’s status at running (Custom and Default)

1.45:

  • Added a Far Cry 2 - like running system (Custom and Default)
    /\ Changed AK-47’s model (Custom)
    /\ Fixed USP’s accuracy (Default)

1.4:

  • Added a Boberg XR9 (Custom)
  • Added an USP (Default)
  • Added an UMP45 (Custom and Default)
  • Boberg and M4A1’s got attachable silencers (Custom and Default)
    /\ Changed the M4A1’s model (Custom)
    /\ Fixed a “GetFOV” bug when dropping your weapon (Custom and Default)
    /\ Fixed Glock-18’s huge recoil (Custom and Default)
    /\ Fixed some weapons having wrong icons (Custom and Default)
    /\ Decreased jamming chance by 1% on all weapons (Custom and Default)

1.3:

  • Added a P90 (Custom and Default)
  • Added an IMI Galil (Custom and Default)
  • Added a Famas G2/F1 (G2 - Custom; F1 - Default)
    /\ Fixed ironsights not increasing accuracy (Custom and Default)
    /\ Fixed invalid accuracy display in 1.22 when not standing still/crouching still (Custom and Default)
    /\ Fixed Desert Eagle having automatic fire (for the second time?!(Default))

1.22:

  • Using your ironsights from now on gives more precision (custom and default)
  • Using your ironsights from now on zooms in (custom and default)
  • Added a new indicator (Thanks to Kogitsune!) (custom and default)
    /\ Fixed a bug when you couldn’t drop weapons but you could spam alot broken of those (default) (!)

1.21:

  • Added weapons which use default Valve’s models
  • Accuracy now depends on Condition
    /\ Fixed M249 Para’s huge damage (custom and default)
    /\ Fixed M249 Para’s 5 seconds un-jam time (custom)
    /\ Fixed M249 Para giving additional 100 bullets when taken into hands (custom and default)
    /\ Changed FiveSeven’s un-jamming animation from Draw to Reload (custom)
    And some other stuff I can’t remember

1.2:

  • Added custom models
  • Added a P228
    /\ Made it so you have to press 3 times your reload button to un-jam your weapon
    /\ Changed the Condition Indicator’s color from green to blue
    /\ Fixed Desert Eagle having automatic fire
    /\ Fixed Desert Eagle bugging when it needs to get un-jammed
    /\ Tweaked up weapons’ accuracy

1.1:
/\ Fixed a bug when you got a SHITLOAD of LUA error spam
/\ Fixed TMP dealing lots of damage
/\ Fixed players disconnecting when dropping their broken weapon (!)

Team:
LUA
L337N008
Kogitsune

Models
shoe

Credits:
L337N008
Kogitsune
shoe
-WildBill-
[/release]

New versions:
1.61:
http://www.garrysmod.org/img/?t=dll&id=71470

1.6 (Download this first!):
http://solidfiles.com/info_imgs/9JyV.jpg

YouTube Video:

AGenericSoldier’s videos:
Part 1:
[media]http://www.youtube.com/watch?v=4LZhJ8RGRO8&feature=related[/media]

Part 2:
[media]http://www.youtube.com/watch?v=tf7R8PVV8u4

And again, hope you guys will like it. :3

** YOU CANNOT REDISTRIBUTE OR USE THESE SWEP’S CODE FOR YOUR OWN PURPOSES WITHOUT MY PERMISSION.**

I think you need some way to repair, otherwise it’s just annoying (outside a gamemode)

Also, how does the dynamic aiming work? :open_mouth:

I was thinking about it too, I’ll try to add that.

P.S. their condition don’t go like from 100% to 90% in 30 bullets.

Like in Counter-Strike: Source. If you sit down, you will get better aim if you run, it will be worse, etc.

Why no M3 Super?

Give me a proper pumping code that will work normally in Multiplayer.

Oh.

[lua]function SWEP:Reload( )
if self.Reloading or self:Clip1( ) > self.Primary.ClipSize - 1 or self:Ammo1( ) < 1 then
return
end

local anim

self.Reloading = true

anim = self:GetAnimation( "Start Reload" )

self.Owner:SetAnimation( PLAYER_RELOAD )
self:SendWeaponAnim( anim.Animation )

self.NextReload = CurTime( ) + anim.Length

end

function SWEP:Initialize( )
self:AddAnimation( “Draw” , ACT_VM_DRAW , 22 / 30 )
self:AddAnimation( “Shoot” , ACT_VM_PRIMARYATTACK , 08 / 30 )
self:AddAnimation( “Dry Fire” , ACT_VM_DRYFIRE , 10 / 30 )
self:AddAnimation( “Pump” , ACT_SHOTGUN_PUMP , 12 / 30 )
self:AddAnimation( “Start Reload” , ACT_SHOTGUN_RELOAD_START , 15 / 30 )
self:AddAnimation( “Finish Reload” , ACT_SHOTGUN_RELOAD_FINISH , 13 / 30 )
self:AddAnimation( “Add Shell” , ACT_VM_RELOAD , 12 / 30 )

self:AddSound( "Shoot", "weapons/shotgun/shotgun_fire6.wav" )
self:AddSound( "Shoot", "weapons/shotgun/shotgun_fire7.wav" )

self:AddSound( "Reload", "weapons/shotgun/shotgun_reload1.wav" )
self:AddSound( "Reload", "weapons/shotgun/shotgun_reload2.wav" )
self:AddSound( "Reload", "weapons/shotgun/shotgun_reload3.wav" )

self:AddSound( "Pump", "weapons/shotgun/shotgun_cock.wav" )

self:AddSound( "Dry Fire", "weapons/pistol/pistol_empty.wav" )

self:AddIron( "None"	, Vector( ) * 0			, Vector( ) * 0, 0.5 	)

self.CurrentIron 	= self:GetIron( "None" )
self.TargetIron 	= self:GetIron( "None" )

if SERVER then
	self:SetWeaponHoldType( self.HoldType )
end

end

function SWEP:Think( )
if not self.Reloading then
return
end

local now, anim, res

now = CurTime( )

self.NextReload = self.NextReload or CurTime( )

if now &lt; self.NextReload then
	return
end
	
if not ValidEntity( self.Owner ) or not self.Owner:Alive( ) then
	self.Reloading = false
	return
end

res = self:Ammo1( )

if res &lt; 1 or not self.Reloading then
	self.Reloading = false
	anim = self:GetAnimation( "Finish Reload" )
	self:SendWeaponAnim( anim.Animation )
	gamemode.Call( "SetNextAttack", self.Owner, self, anim.Length )
	return
end

if self:Clip1( ) == self.Primary.ClipSize then
	self.Reloading = false
	anim = self:GetAnimation( "Finish Reload" )
	self:SendWeaponAnim( anim.Animation )
	gamemode.Call( "SetNextAttack", self.Owner, self, anim.Length )
	return
else
	anim = self:GetAnimation( "Add Shell" )
	self:SendWeaponAnim( anim.Animation )
end

gamemode.Call( "SetNextAttack", self.Owner, self, anim.Length )

if SERVER then
	self.Owner:SetAmmo( res - 1, self:GetPrimaryAmmoType( ) )
	self:SetClip1( self:Clip1( ) + 1 )
	self.Owner:EmitSound( self:GetSound( "Reload" ) )
end

self.NextReload = now + anim.Length

end
[/lua]

It should be fairly obvious what the custom stuff is for, ripped from one of the stampede shotguns. Any function that looks relatively useful ( Add*/Get*, SetNextAttack ) is stuff coded into the gamemode. Aside from a slight bug that plays the pump sound twice, works in both instances.

RealCS

nobody knows what it is anymore but whatever.

Thank you. :3

I’m about to release an update which will fix 3 bugs:

  • Giving shitload of LUA spam when walking while crouched with a FiveSeven
  • Huge damage for TMP
  • Players disconnecting whenever they drop their weapons

Testing now.

EDIT:

Testing done, here’s the link:
http://www.garrysmod.org/img/?t=dll&id=66241

Nice I’ll give these a shot. Sorry, bad pun. These’d be good for Zombie Survival, or something along those lines.

Yeah, Farcry 2 style weapons :smiley:

I wish you could actually see them rust and have jamming animations too. That’d be sick, but this is the closest we can get.

Ah, you should make it so when the weapon is jammed, the faster you press reload, the faster it unjams ( if this is like Far Cry 2) or maybe some custom ammo types, like the SWEPS in Half-Life Renaissance.

Maybe Custom Models?

Yeah, I got inspired by Far Cry 2, but I’m not sure how to make it so the faster you press it, the faster it un-jams :/.

Hm, if people really want it, I might add custom models.
Everyone who wants custom models write this as a quick reply:
“+1 To custom models” (Without the quotes OFC).

+1 to custom models.

Make it so you have to click X times before it un-jams. That should work.

Hm, good idea.

EDIT:

Done. Now you will have to press 2 times your RELOAD button to un-jam the weapon.

That makes jamming less of an emergency, and more of an annoyance. You should have to press it more times, to promote a feeling of urgency when being chased down by that Antlion Guard that you took a dump on.

OH! And +1 Custom Models.

Hm. Does the gun lose precision the more it is worn out?

  • custom models.
    Please.

+1 Custom Models.

These are sweet! I love using these for my LAN survival game.