Combine Weapon Errors - I don't trust WDYNHW V3

Hello. I don’t trust the What Do You Need Help With Thread V3. I’ve been having problems with this for a while. I am trying to create replicas of the HL2 weapons, but change some of how they act (as if a NPC were using them). They will also kick a little differently, and be more realistic.
Could someone please help me? :tinfoil:

[lua]SWEP.Author = "LuaVirusFree"SWEP.Contact = “”
SWEP.Purpose = “Aim, shoot, dispatch.”
SWEP.Instructions = “Primary shoots.”

SWEP.Spawnable = false
SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_pistol.mdl”
SWEP.WorldModel = “models/weapons/w_pistol.mdl”

SWEP.Primary.ClipSize = 18
SWEP.Primary.DefaultClip = 0 – We don’t want to start loaded.
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “AlyxGun”

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”

local ShootSound = Sound( “Weapon_Pistol.NPC_Single” )
local ReloadSound = Sound( “Weapon_Pistol.NPC_Reload” )
local EmptySound = Sound( “Weapon_Pistol.Empty” )
local BurstSound = Sound( “Weapon_Pistol.Burst” )
local SwitchSingleSound = Sound( “Weapon_Pistol.Special1” )
local SwitchBurstSound = Sound( “Weapon_Pistol.Special2” )

Reload reloads.
function SWEP:Reload()
if self:Clip1() == 18 then self.Clip1 = 19 end
self.Weapon:EmitSound( ReloadSound )
self:DefaultReload( ACT_VM_RELOAD )

local ReloadTime = CurTime()
Think reloads
local ReloadTime = CurTime()
function SWEP:Think()
if self:Clip1() < 18 && CurTime() > ReloadTime then
self.Owner:SetAmmo( 19, “Pistol” )
if self.Owner:KeyPressed( IN_ATTACK ) then
ReloadTime = CurTime() + 7

–function SWEP:CanPrimaryAttack()
– if self:Clip1 < 8 then return false end

function SWEP:PrimaryAttack()

if !self:CanPrimaryAttack() then self.Weapon:EmitSound( EmptySound ) return end
    -- TODO: Make and shoot bullet entity. Reduce ammo.
if !BurstFireMode then
    local Player = self.Owner
    local Bullet = {}
    if SERVER then
        Bullet.Nine = ents.Create( "bullet_Nine" )
        Bullet.Nine:SetPos( Player:GetShootPos() )  -- TODO: Get the world model's muzzle?
        Bullet.Nine:SetAngles( self.Owner:GetAngles() )
        Bullet.Nine:SetOwner( Player )
        local bulPhy = Bullet.Nine:GetPhysicsObject()
        bulPhy:SetVelocity((self.Owner:GetAngles()+ Angle(1, 0, 0)):Forward() * 33600 ) -- 5.7mm Muzzle Velocity.
    --  Bullet.Nine:SetVar("Acceleration",accel)
    --  local Force = Angle:__add(Player:GetAimVector(), Angle(-30, 0, 0) )*256
    --  bulPhy:SetVelocity((self.Owner:GetAngles()+ Angle(45, 0, 0)):Forward() * 1 * CurTime() * 1)
    --  Bullet.AngTr = Angle(self.Owner:GetAngles()+ Angle(45, 0, 0))--:Forward()
    --  Bullet.AngTr2 = Angle(self.Owner:GetAngles()+Angle(-45, 0, 0))--:Forward()
        self.Weapon:EmitSound( ShootSound )
        self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK  )
    --  timer.Simple( 0.3, self.Weapon.SendWeaponAnim, self, ACT_VM_IDLE )
        self.Weapon:SetNextPrimaryFire( CurTime()+0.4 )
        self.Weapon:SetNextSecondaryFire( CurTime()+2 )
elseif BurstFireMode then
    local Player = self.Owner
    local Bullet = {}
    local function ShootBurret()
        if self:Clip1() &lt; 1 then return end
        if self:Clip1() &lt; 3 then
            self:EmitSound( ShootSound )
        if SERVER then
            Bullet.Nine = ents.Create( "bullet_Nine" )
            Bullet.Nine:SetPos( Player:GetShootPos() )  -- TODO: Get the world model's muzzle?
            Bullet.Nine:SetAngles( self.Owner:GetAngles() )
            Bullet.Nine:SetOwner( Player )
            local bulPhy = Bullet.Nine:GetPhysicsObject()
            bulPhy:SetVelocity((self.Owner:GetAngles()+ Angle(1, 0, 0)):Forward() * 33600 )
        self:ApplyRecoil(0.73,NewSpray) -- Lil less kick for burst.
        timer.Simple(0.1, ShootBurret())
        timer.Simple(0.2, ShootBurret())
        if self:Clip1() &gt;= 3 then
            self.Weapon:EmitSound( BurstSound )
        self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK  )
        self.Weapon:SetNextPrimaryFire( CurTime()+0.4 )
        self.Weapon:SetNextSecondaryFire( CurTime()+2 )
if self:Clip1()-1 &lt;= 0 then timer.Simple(0.4, self:Reload()) end

        local tBullet = {} -- This is the bullet our bullet SENT will be firing when it hits something.  Everything except force and damage is determined by the bullet SENT
        tBullet.Force   = 0.15*3
        tBullet.Damage  = 3
        local tTrace = {} --This is the trace the bullet SENT uses to see if it has hit something
        tTrace.filter = filter or {self.Owner,eBullet}
        tTrace.mask = mask


function SWEP:ApplyRecoil(recoil) – Kick your view.

if self.OwnerIsNPC or (SERVER and not self.Owner:IsListenServerHost()) then return end
local EyeAng = Angle(
recoil*math.Rand(-1,-0.7), -- Up/Down recoil
recoil*math.Rand(-0.4,0.4), -- Left/Right recoil
-- Punch the player's view
self.Owner:ViewPunch(EyeAng) -- This smooths out the player's screen movement when recoil is applied
self.Owner:SetEyeAngles(self.Owner:EyeAngles() + EyeAng)

function SWEP:DoDMG(EntHit)
local OldHealth = EntHit:GetHealth()
local dmginfo = DamageInfo()
local DMGToDo=math.min(OldHealth-1,ATKPower)
local LostDmg = OldHealth-DMGToDo
dmginfo:SetDamage( DMGToDo ) – 7 damage or whatever is left-1
dmginfo:SetDamageType( DMG_STUN ) --Stun damage
dmginfo:SetAttacker( self.Owner ) --You.
dmginfo:SetSetInflictor( self )
dmginfo:SetDamageForce( self.Owner:EyeAngles()*20 ) --Launch away

local HealSteps=OldHealth-LostDmg
  EntHit:TakeDamageInfo( dmginfo )
    Player:GiveAmmo( ATKPower, "GaussEnergy", true )
for i=1,HealSteps do
    timer.Simple(0.05*i,function() EntHit:SetHealth( OldHealth + 1*i end ) )    -- In at most 0.65 seconds, replenish health damage. TODO? Is it dead?

SecondaryAttack switches fire mode.
local BurstFireMode = false
function SWEP:SecondaryAttack()
if !BurstFireMode then
BurstFireMode = true
self.Weapon:EmitSound( SwitchBurstSound )
if BurstFireMode then
BurstFireMode = false
self.Weapon:EmitSound( SwitchSingleSound )
self.Weapon:SetNextPrimaryFire( CurTime()+0.4 )
self.Weapon:SetNextSecondaryFire( CurTime()+2 )

function SWEP:Initialize()
– self:EmitSound( Activated )
local Player=self.Owner
self.Owner:SetAmmo( math.max(19, Player:GetAmmoCount(“Pistol”)), “Pistol” ) – The REAL line 202

The line numbers are wrong after a certain point, so I labeled the actual line “The Real Line”.

[ERROR] addons/combinification/lua/weapons/pistol/shared.lua:201: attempt to call method 'GetAmmoCount' (a nil value)
1. unknown - addons/combinification/lua/weapons/pistol/shared.lua:201

[editline]20th January 2013[/editline]

My old helper got perma-banned, but he would’ve already given me a solution. If that didn’t work, another one. His name was, I believe, Ninjas. Maybe he made a new account?

[editline]20th January 2013[/editline]

I will have these weapons: Stun Baton, USP Match Pistol, MP7 SMG, Buckshot Shotgun and 2x AR2 Pulse Rifle, one that alt-fires and one that can’t.

So I guess that makes this Help Me Because My Problems Are More Important V1.

No. The WDYNHW thread is moving way too slowly. Also, it fills up so fast that I can’t even find my answers. If people could always use the quote function, that would help.

Seriously, stop fucking spamming the forum with your errors, if someone wants to help you they’ll help you.
Making another thread won’t draw attention to your problem with ‘your’ code, it will only draw attention to how impatient and how immature you are to even wait for someone to help you.

Seriously, I’m not going to listen to anything you say. And I don’t spam, but with so many pages, I don’t expect anyone else to look backwards through it. I just want to make sure my problem is seen =P

Any they should want to help the guy with half of a brain because of a car accident…

Don’t make random appeals for pity.

You made this thread because you were unwilling to play fair to the other people with problems, instead deciding to contribute to the plague of simple errors that is this section of facepunch.

Oh, really, if it’s such a simple error then prove it. Tell me what’s wrong.


you are acting like a big ass morron

YOU are the one who isnt welcome here

so until you change your attitude no one is going to help you at all

And let’s be honest, if you can’t figure out these simple swep errors, there’s no way you could make a game mode as complex as you’re pitching. All you’ve done is post ideas, I think it’s time to throw in the towel

A lot of people don’t even consider thinking, “Hmm, What’s the difference between this line and the other lines”.

I think they decide to just come to the community and ask for help because they’re so ungodly lazy it just hurts to think about it.

Again, if it’s such a simple problem, please enlighten me. And after my injury… I have become more aggressive. For that matter, before it happened I didn’t get these kinds of errors. Either tell me what’s wrong, or how to figure it out.

After you’re injury?

I’m sorry, But should i waltz in here, And say.

Hey guys, I need help with this, I have tachycardia, Chronic hallucinations, Locomotion problems, and a horrible heart condition.

The answer is no, I shouldn’t, Because despite my problems, Everyone is an equal being to another, And we should be treated as such.

Idiot. I got a BRAIN INJURY in a CAR ACCIDENT. out of 1-10, 1 being a smack to the head and 10 being having no more brain than what I need, it would have ranked at an 8!
At first, I wasn’t able to walk, talk, or even control my body. Actually, at the very first month afterwords, I would have died if I was talked to.

lol no

now you are just using a very lame excuse i got a lot of friends and fimilar who had brain injuries and all of them are perfectly ok

also if you truly had a brain injury wouldnt you have some sort of ACTUAL problem? becouse right now it looks like …you know… an lame excuse

so get out

FUCK OFF! It’s serious you fucking twat. And I will be perfectly fine AFTER my rehab. As for lua, rehab doesn’t help with that. Read my edit. It’s amazing that I’m even able to press the keys on my keyboard.

[editline]20th January 2013[/editline]

And the fact that I am giving myself the challenge of making such a gamemode is just my way of seeing how well I am now.

(User was banned for this post ("Flaming" - Ninja101))

Do you need to resort to such language to express yourself?

Chill out for a minute and just think about what your saying.

Let me see… right now I have Physical Therapy, Speech Therapy and Occupational Therapy all in rehab, as well as a psychologist to help repair my brain in more ways. Also, I have recreational therapy to reintegrate myself into the community. If you want me to get a list of all of my problems, I will try my hardest.

[editline]20th January 2013[/editline]

Yea… should I add that the brain injury has caused me to get angry more easily, and be more aggressive? I’m taking medicine for that, but it doesn’t fix the problem.

If you want to waste your time trying to get me to pity you, Then go ahead.

I had just graduated high school before the accident happened. I forgot almost 2 years of my life.

Stop pulling the brain damage card, no one feels bad for you, you said yourself you got it from driving drunk/high at 90MPH, and you got a friend hurt. It’s your own damn fault, stop trying to guilt us