1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
if SERVER then
AddCSLuaFile("shared.lua")
end
if CLIENT then
SWEP.ViewModelFOV = 55
SWEP.ViewModelFlip = false
SWEP.PrintName = "CMP-250"
SWEP.IconLetter = "f"
SWEP.Slot = 3
SWEP.Slotpos = 1
end
SWEP.HoldType = "smg"
SWEP.Base = "rad_base"
SWEP.UseHands = true
SWEP.ViewModel = "models/weapons/c_smg1.mdl"
SWEP.WorldModel = "models/weapons/w_smg1.mdl"
SWEP.SprintPos = Vector (3.6907, -0.6364, -0.5846)
SWEP.SprintAng = Vector (-2.2928, 28.9069, 0)
SWEP.IsSniper = false
SWEP.AmmoType = "SMG"
SWEP.FirstShot = true
SWEP.Primary.Sound = Sound( "Weapon_smg1.Burst" )
SWEP.Primary.Sound2 = Sound( "weapons/smg1/smg1_fireburst1.wav" )
SWEP.Primary.ReloadSound = Sound( "Weapon_smg1.reload" )
SWEP.Primary.Recoil = 12.5
SWEP.Primary.Damage = 30
SWEP.Primary.NumShots = 3
SWEP.Primary.Cone = 0.045
SWEP.Primary.Delay = 0.600
SWEP.Primary.ClipSize = 18
SWEP.Primary.Automatic = true
function SWEP:PrimaryAttack()
if not self.Weapon:CanPrimaryAttack() then
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
return
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) )
self.Weapon:SetClip1( self.Weapon:Clip1() - self.Primary.NumShots )
self.Weapon:ShootEffects()
if self.IsSniper and self.Weapon:GetZoomMode() == 1 then
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 )
else
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
end
if self.Weapon:GetZoomMode() > 1 then
self.Weapon:UnZoom()
end
if SERVER then
self.Owner:AddAmmo( self.AmmoType, self.Primary.NumShots * -1 )
self.Owner:EmitSound( self.Primary.Sound2, 100, math.random( 120, 130 ) )
end
end
function SWEP:CanPrimaryAttack()
if self.HolsterMode or self.ReloadTime or self.LastRunFrame > CurTime() then return false end
if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < self.Primary.NumShots then
self.Weapon:EmitSound( self.Primary.Empty )
return false
end
if self.Weapon:Clip1() <= 0 then
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
self.Weapon:DoReload()
if self.Weapon:GetZoomMode() != 1 then
self.Weapon:UnZoom()
end
return false
end
return true
end
--[[function SWEP:PrimaryAttack()
if not self.Weapon:CanPrimaryAttack() then
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
return
end
if self.FirstShot then
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.ShotDelay )
self.AutoShoot = CurTime() + self.Primary.ShotDelay
else
self.Owner:EmitSound( self.Primary.Sound2, 100, math.random(95,105) )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
end
self.FirstShot = !self.FirstShot
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
if SERVER then
self.Owner:AddAmmo( self.AmmoType, -1 )
end
end]]
function SWEP:DoReload()
local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.100 )
self.Weapon:EmitSound( self.Primary.ReloadSound )
self.ReloadTime = CurTime() + time
end
function SWEP:ReloadThink()
if self.ReloadTime and self.ReloadTime <= CurTime() then
self.ReloadTime = nil
self.Weapon:SetClip1( self.Primary.ClipSize )
end
end
|