Report abuse

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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
function SWEP:MakeOtherModel()
if (CLIENT) then
  local vm = self.Owner:GetViewModel()
  self.Owner.Decor1 = ClientsideModel("models/weapons/v_pistol.mdl", RENDER_GROUP_VIEW_MODEL_OPAQUE)
  self.Owner.Decor1:SetPos(vm:GetPos() + vm:GetRight()*0)
  self.Owner.Decor1:SetAngles(vm:GetAngles())
  self.Owner.Decor1:SetParent(vm)
  self.Owner.Decor1:SetModelScale(Vector(1, 1, 1))
  self.Owner.Decor1:SetNoDraw(true)
  end
end

function SWEP:ViewModelDrawn()
  if (CLIENT) then
    if not self.Owner.Decor1 then self:MakeOtherModel() end
    if self.Owner.Decor1 then self.Owner.Decor1:DrawModel() end
      if LocalPlayer():GetActiveWeapon():GetNWBool("OtherModRePos") then
        self.Owner.Decor1:Remove()
        self:MakeOtherModel()
      end
      self.Owner.Decor1:FrameAdvance( RealFrameTime( ) )
      if self.Weapon:GetNWBool("SecDraw") then
        self.Owner.Decor1:SetSequence(self.Owner.Decor1:LookupSequence("draw"))
        self.Owner.Decor1:SetCycle(0)
      end
      if self.Weapon:GetNWBool("SecIdle") then
        self.Owner.Decor1:SetSequence(self.Owner.Decor1:LookupSequence("idle01"))
        self.Owner.Decor1:SetCycle(0)
      end
      if self.Weapon:GetNWBool("SecIdleEmpty") then
        self.Owner.Decor1:SetSequence(self.Owner.Decor1:LookupSequence("idle01empty"))
        self.Owner.Decor1:SetCycle(0)
      end
      if self.Weapon:GetNWBool("SecFire") then
        self.Owner.Decor1:SetCycle(0)
        self.Owner.Decor1:SetSequence(self.Owner.Decor1:LookupSequence("fire"..math.random(1,3)..""))
        self.Owner.Decor1:SetCycle(0)
      end
      if self.Weapon:GetNWBool("SecReload") then
        self.Owner.Decor1:SetSequence(self.Owner.Decor1:LookupSequence("reload"))
        self.Owner.Decor1:SetCycle(0)
      end
    end
  end

if (SERVER) then
  AddCSLuaFile("shared.lua")
  SWEP.HoldType    = "pistol"
end

if (CLIENT) then
  SWEP.Category       = "Dual Wields";
  SWEP.PrintName      = "Dual Hl2 Pistols"  
  SWEP.Slot         = 1
  SWEP.SlotPos       = 1
  SWEP.IconLetter     = "N"
  SWEP.ViewModelFOV    = 58

  killicon.AddFont("weapon_real_cs_ak47", "CSKillIcons", SWEP.IconLetter, Color( 0, 200, 0, 255 ) )
end

SWEP.Instructions       = ""
SWEP.Author           = "Zoey"
SWEP.Contact            = ""

SWEP.Base         = "insurgency_base"
SWEP.ViewModelFlip    = true

SWEP.Spawnable       = false
SWEP.AdminSpawnable   = true

SWEP.ViewModel      = "models/weapons/v_pistol.mdl"
SWEP.WorldModel      = "models/weapons/w_pistol.mdl"

SWEP.Primary.Sound      = Sound( "Weapon_Pistol.Single" )
SWEP.Primary.EmptySound    = Sound( "Weapon_Pistol.Empty" )
SWEP.Primary.Recoil     = 0.2
SWEP.Primary.Damage     = 8
SWEP.Primary.NumShots     = 1
SWEP.Primary.Cone       = 0.015
SWEP.Primary.ClipSize     = 18
SWEP.Primary.Delay       = 0.13
SWEP.Primary.DefaultClip   = 100
SWEP.Primary.Automatic     = false
SWEP.Primary.Ammo       = "pistol"

SWEP.Secondary.Sound      = Sound( "Weapon_Pistol.Single" )
SWEP.Secondary.EmptySound    = Sound( "Weapon_Pistol.Empty" )
SWEP.Secondary.Recoil     = 0.2
SWEP.Secondary.Damage     = 8
SWEP.Secondary.NumShots     = 1
SWEP.Secondary.Cone       = 0.015
SWEP.Secondary.ClipSize     = 18
SWEP.Secondary.Delay       = 0.13
SWEP.Secondary.DefaultClip   = 100
SWEP.Secondary.Automatic     = false
SWEP.Secondary.Ammo       = "pistol"

SWEP.IronSightsPos = Vector (0,0,0)
SWEP.IronSightsAng = Vector (0,0,0)

SWEP.Penetration      = true
SWEP.MaxPenetration     = 11.5
SWEP.MaxWoodPenetration   = 16.5
SWEP.Ricochet      = true
SWEP.MaxRicochet      = 0

function SWEP:Deploy()
if not self.Weapon:GetNWBool("First") then
self.Weapon:SetNWBool("First",true)
self.Weapon:SetNWInt("Ammo2",18)
end
if self.Weapon:Clip1() > 0 then
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
else
self.Weapon:SendWeaponAnim(ACT_VM_DRAW_EMPTY)
end
self.Weapon:SetNWBool("OtherModRePos",true)
timer.Simple(0.05, function()
self.Weapon:SetNWBool("OtherModRePos",false)
end)
timer.Simple(0.04, function()
self.Weapon:SetNWBool("SecDraw",true)
end)
timer.Simple(0.065, function()
self.Weapon:SetNWBool("SecDraw",false)
end)
self.SecIdle = (CurTime() + self.Owner:GetViewModel():SequenceDuration())
self.Idle = (CurTime() + self.Owner:GetViewModel():SequenceDuration())
self.Reloadaftershoot = CurTime() + self.Owner:GetViewModel():SequenceDuration()
self.Weapon:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
self.Weapon:SetNextSecondaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
return true
end

function SWEP:Holster()
return true
end

/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:Reload()

  if self.Owner:KeyDown(IN_USE) then
  self:ReloadAlt()
  return false end

  if self.Reloadaftershoot and CurTime()< self.Reloadaftershoot then return end

  if ( self.Weapon:Clip1() < self.Primary.ClipSize ) and self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then
    self.Weapon:SendWeaponAnim(ACT_VM_RELOAD)
    self.Weapon:EmitSound("Weapon_Pistol.Reload")
    self.Reloadaftershoot = CurTime() + self.Owner:GetViewModel():SequenceDuration()
    self.Weapon:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
    self.Weapon:SetNextSecondaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
    self.DoReload = (CurTime() + self.Owner:GetViewModel():SequenceDuration() - 0.2)
    self.Idle = (CurTime() + self.Owner:GetViewModel():SequenceDuration())
    self.Owner:SetAnimation(PLAYER_RELOAD)
  end
end

/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:ReloadAlt()

  if self.Reloadaftershoot and CurTime()< self.Reloadaftershoot then return end

  if ( self.Weapon:GetNWInt("Ammo2") < self.Primary.ClipSize ) and self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then
    self.Weapon:EmitSound("Weapon_Pistol.Reload")
    self.Weapon:SetNWBool("SecReload",true)
    timer.Simple(0.05, function()
    self.Weapon:SetNWBool("SecReload",false)
    end)
    self.Reloadaftershoot = CurTime() + 2
    self.Weapon:SetNextPrimaryFire(CurTime() + 2)
    self.Weapon:SetNextSecondaryFire(CurTime() + 2)
    self.DoSecReload = (CurTime() + 2)
    self.SecIdle = (CurTime() + 2)
    self.Owner:SetAnimation(PLAYER_RELOAD)
  end
end

/*---------------------------------------------------------
Think
---------------------------------------------------------*/
function SWEP:Think()
if self.Idle and CurTime()>=self.Idle then
self.Idle = nil
if self.Weapon:Clip1() > 0 then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
else
self.Weapon:SendWeaponAnim(ACT_VM_IDLE_EMPTY)
end
end
if self.SecIdle and CurTime()>=self.SecIdle then
self.SecIdle = nil
self.Weapon:SetNWBool("SecIdle",true)
timer.Simple(0.04, function()
self.Weapon:SetNWBool("SecIdle",false)
end)
end
if self.DoSmoke and CurTime()>=self.DoSmoke then self:SmokeEffect() end
if self.DoReload and CurTime()>=self.DoReload then self:Reloadgun() end
if self.DoSecReload and CurTime()>=self.DoSecReload then self.DoSecReload = nil
local start = self.Weapon:GetNWInt("Ammo2")
local taken = math.min( self.Primary.ClipSize, self.Primary.ClipSize - start, self.Owner:GetAmmoCount( self.Primary.Ammo ) )
self.Weapon:SetNWInt("Ammo2",18)
self.Owner:RemoveAmmo( taken , self.Weapon:GetPrimaryAmmoType() ) end
end

/*---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()

  if self.Weapon:Clip1() <= 0 or self.Owner:WaterLevel() >= 3 then
  self.Weapon:EmitSound(self.Primary.EmptySound)
  return end

  self.Weapon:EmitSound(self.Primary.Sound)

  if self.Weapon:Clip1() > 1 then
  self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
  else
  self.Weapon:SendWeaponAnim(ACT_VM_DRYFIRE)
  end
  self:FireBullet(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone)
  self.Owner:ViewPunch(Angle(math.Rand(-0.5,-2.5) * self.Primary.Recoil, math.Rand(-1,1) *self.Primary.Recoil, 0))

  self.Idle = (CurTime() + self.Owner:GetViewModel():SequenceDuration())

  self:TakePrimaryAmmo(1)

  self.Reloadaftershoot = CurTime() + 0.3

  self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)

  self.DoSmoke = CurTime() + 1.2

end

/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()

  if self.Weapon:GetNWInt("Ammo2") <= 0 or self.Owner:WaterLevel() >= 3 then
  self.Weapon:EmitSound(self.Primary.EmptySound)
  return end

  self.Weapon:EmitSound(self.Primary.Sound)

  self.Weapon:SetNWBool("SecFire",true)
  timer.Simple(0.02, function()
  self.Weapon:SetNWBool("SecFire",false)
  end)
  self.SecIdle = CurTime() + 0.8
  self:FireBullet(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone)
  self.Owner:ViewPunch(Angle(math.Rand(-0.5,-2.5) * self.Primary.Recoil, math.Rand(-1,1) *self.Primary.Recoil, 0))

  self.SecIdle = (CurTime() + self.Owner:GetViewModel():SequenceDuration())

  self.Weapon:SetNWInt("Ammo2", self.Weapon:GetNWInt("Ammo2") - 1)

  self.Reloadaftershoot = CurTime() + 0.3

  self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay)

  self.DoSmoke = CurTime() + 1.2

end

function SWEP:DrawHUD()
if (CLIENT) then
draw.SimpleText("Secondary Ammo Left: "..LocalPlayer():GetActiveWeapon():GetNWInt("Ammo2").."","ScoreboardText",ScrW() / 1.2, ScrH() / 1.14,Color(220,20,20,255))
end
end