• Crash when Spawning Custom Sep
    1 replies, posted
Hello, I was testing out hexing from here: [url]http://www.facepunch.com/showthread.php?t=303805[/url] I used Maker's SWep generator (I'm no good at LUA) to test it and changed the models in the .lua file for my new hexed weapons. The problem is when I spawned the SWEP my game immediately crashed, it's done this twice. Can someone tell me what I am fucking up? :v: Here's the file: [code]//General Variables\\ SWEP.DrawCrosshair = true SWEP.Weight = 5 SWEP.ViewModel = "models/weapons/v_ri_akg30.mdl" SWEP.WorldModel = "models/weapons/w_ri_akg30.mdl" SWEP.HoldType = "smg" SWEP.ViewModelFOV = 64 SWEP.Slot = 3 SWEP.Purpose = "Durrr." SWEP.AutoSwitchTo = false SWEP.Contact = "Nope." SWEP.Author = "Nabe_Gewell" SWEP.FiresUnderwater = false SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ReloadSound = "Weapon_Pistol.Reload" SWEP.SlotPos = 0 SWEP.Instructions = "Hurrr." SWEP.AutoSwitchFrom = false SWEP.base = "weapon_base" SWEP.Category = "My Weapons" SWEP.DrawAmmo = true SWEP.PrintName = "AK-47 w/ G-Launcher" //General Variables\\ //Primary Fire Variables\\ SWEP.Primary.NumberofShots = 1 SWEP.Primary.Ammo = "smg1" SWEP.Primary.Spread = 0.1 SWEP.Primary.ClipSize = 25 SWEP.Primary.Force = 2 SWEP.Primary.Damage = 25 SWEP.Primary.Delay = 0.2 SWEP.Primary.Recoil = 0.6 SWEP.Primary.DefaultClip = 32 SWEP.Primary.Automatic = true SWEP.Primary.TakeAmmo = 1 SWEP.Primary.Sound = "weapon_rif_Ak47.Single" //Primary Fire Variables\\ //Secondary Fire Variables\\ SWEP.Secondary.ClipSize = 3 SWEP.Secondary.Automatic = false SWEP.Secondary.NumberofShots = 1 SWEP.Secondary.Damage = 10 SWEP.Secondary.Ammo = "Pistol" SWEP.Secondary.Spread = 0.1 SWEP.Secondary.Magnitude = "10" SWEP.Secondary.DefaultClip = 3 SWEP.Secondary.Force = 10 SWEP.Secondary.Recoil = 1 SWEP.Secondary.Sound = "Weapon_Mortar.Single" SWEP.Secondary.TakeAmmo = 1 SWEP.Secondary.Delay = 5 //Secondary Fire Variables\\ //SWEP:Initialize()\\ function SWEP:Initialize() util.PrecacheSound(self.Primary.Sound) util.PrecacheSound(self.Secondary.Sound) if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) end end //SWEP:Initialize()\\ //SWEP:PrimaryFire()\\ function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local bullet = {} bullet.Num = self.Primary.NumberofShots bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0) bullet.Tracer = 0 bullet.Force = self.Primary.Force bullet.Damage = self.Primary.Damage bullet.AmmoType = self.Primary.Ammo local rnda = self.Primary.Recoil * -1 local rndb = self.Primary.Recoil * math.random(-1, 1) self:ShootEffects() self.Owner:FireBullets( bullet ) self.Weapon:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) end //SWEP:PrimaryFire()\\ //SWEP:SecondaryFire()\\ function SWEP:SecondaryAttack() if ( !self:CanSecondaryAttack() ) then return end local rnda = -self.Secondary.Recoil local rndb = self.Secondary.Recoil * math.random(-1, 1) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) local eyetrace = self.Owner:GetEyeTrace() self.Weapon:EmitSound ( self.Secondary.Sound ) self:ShootEffects() local explode = ents.Create("env_explosion") explode:SetPos( eyetrace.HitPos ) explode:SetOwner( self.Owner ) explode:Spawn() explode:SetKeyValue("iMagnitude","175") explode:Fire("Explode", 0, 0 ) explode:EmitSound("weapon_AWP.Single", 400, 400 ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) self:TakePrimaryAmmo(self.Secondary.TakeAmmo) end //SWEP:SecondaryFire()\\ [/code]
Bump, also I misspelled SWep, rate me bad spelling.
Sorry, you need to Log In to post a reply to this thread.