Discord
Steam
/
Garry's Mod
/
Help
/
SWEP Trouble
Login/Join
Event Log
SWEP Trouble
0 replies, posted
Search
In This Thread
I'm trying to make a few SWEPs, and all is good until I use custom models or sounds. Here's my code: [code]//General Variables\\ SWEP.AdminSpawnable = true SWEP.ViewModelFOV = 64 SWEP.ViewModel = "[models/weapons/v_pist_race.mdl]" SWEP.DrawAmmo = false SWEP.AutoSwitchTo = false SWEP.Slot = 0 SWEP.HoldType = "Pistol" SWEP.PrintName = "SVI Infinity Xcelerator" SWEP.Author = "asdf" SWEP.Spawnable = true SWEP.AutoSwitchFrom = false SWEP.FiresUnderwater = false SWEP.WorldModel = "[models/weapons/w_pist_race.mdl]" SWEP.DrawCrosshair = true SWEP.Category = "asfd" SWEP.SlotPos = 0 SWEP.ReloadSound = "Weapon_Pistol.Reload" SWEP.Instructions = "sdf" SWEP.Contact = "asdf" SWEP.Weight = 5 SWEP.Purpose = "sdfa" SWEP.base = "weapon_base" //General Variables\\ //Primary Fire Variables\\ SWEP.Primary.Sound = "Weapon_Pistol.Single" SWEP.Primary.Damage = 11 SWEP.Primary.TakeAmmo = 1 SWEP.Primary.ClipSize = 13 SWEP.Primary.Ammo = "pistol" SWEP.Primary.DefaultClip = 32 SWEP.Primary.Spread = 0.1 SWEP.Primary.NumberofShots = 1 SWEP.Primary.Automatic = false SWEP.Primary.Recoil = 0.8 SWEP.Primary.Delay = 0.2 SWEP.Primary.Force = 2000 //Primary Fire Variables\\ //Secondary Fire Variables\\ SWEP.Secondary.NumberofShots = 0 SWEP.Secondary.Force = 0 SWEP.Secondary.Spread = 0.0 SWEP.Secondary.Sound = "asdf.wav" SWEP.Secondary.DefaultClip = 0 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "ammo_smg1" SWEP.Secondary.Recoil = 1 SWEP.Secondary.Delay = 50.0 SWEP.Secondary.TakeAmmo = 0 SWEP.Secondary.ClipSize = 0 SWEP.Secondary.Damage = 0 //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:SecondaryFire() return false end //SWEP:SecondaryFire()\\ [/code] If I try to use a custom sound I just get errors, and if I use a custom model I just get the big flashing error model (I hexed the models, same result). What do I need to do to make this work?
Sorry, you need to
Log In
to post a reply to this thread.