I am making a swep pack for a new RP based on battlefield 2142, and have encountered problems. It has been going smoothly, I am fairly experienced, and have added much more than just hexing and changing values. My question is that I can’t get reload sounds to work. I am using the CSS realistic weapons base, and yes I will give full credit. I am making sweps of a BF2142 smg that was a skin for the smg1, a bianchia 6 skin for the M249 saw in css, and a futuristic assault rifle for the AUG in CSS. what exactly do I need to do to get reload sounds working? the actual code base is still the normal 4.0. Thanks for any help you can provide.
Bump. and here is the code i’m using for the SMG
– Read the weapon_real_base if you really want to know what each action does
if (SERVER) then
AddCSLuaFile(“shared.lua”)
SWEP.HoldType = “ar2”
end
if (CLIENT) then
SWEP.PrintName = “BF2142 SMG”
SWEP.Slot = 2
SWEP.SlotPos = 1
SWEP.IconLetter = “m”
killicon.AddFont("weapon_real_cs_p90", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ))
end
/---------------------------------------------------------
Muzzle Effect + Shell Effect
---------------------------------------------------------/
SWEP.MuzzleEffect = “rg_muzzle_pistol” – This is an extra muzzleflash effect
– Available muzzle effects: rg_muzzle_grenade, rg_muzzle_highcal, rg_muzzle_hmg, rg_muzzle_pistol, rg_muzzle_rifle, rg_muzzle_silenced, none
SWEP.ShellEffect = “none” – This is a shell ejection effect
– Available shell eject effects: rg_shelleject, rg_shelleject_rifle, rg_shelleject_shotgun, none
SWEP.MuzzleAttachment = “muzzle” – Should be “1” for CSS models or “muzzle” for hl2 models
SWEP.ShellEjectAttachment = “1” – Should be “2” for CSS models or “1” for hl2 models
/-------------------------------------------------------/
SWEP.Instructions = "Damage: 15%
Recoil: 4%
Precision: 87%
Type: Automatic
Rate of Fire: 900 rounds per minute
Change Mode: E + Right Click"
SWEP.Base = “weapon_real_base_reddot3”
SWEP.ViewModelFlip = false
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = “models/weapons/v_bf2142_smg.mdl”
SWEP.WorldModel = “models/weapons/w_smg_p90.mdl”
SWEP.Primary.Sound = Sound(“weapons/2142_smg/smg_fire1.wav”)
SWEP.Primary.Recoil = 0.6
SWEP.Primary.Damage = 9.5
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.018
SWEP.Primary.ClipSize = 45
SWEP.Primary.Delay = 0.075
SWEP.Primary.DefaultClip = 45
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “pistol”
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”
SWEP.data = {}
SWEP.mode = “auto”
SWEP.data.semi = {}
SWEP.data.auto = {}
/---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------/
function SWEP:PrimaryAttack()
if not self:CanPrimaryAttack() or self.Owner:WaterLevel() > 2 then return end
-- If your gun have a problem or if you are under water, you'll not be able to fire
self.Reloadaftershoot = CurTime() + self.Primary.Delay
-- Set the reload after shoot to be not able to reload when firering
self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay)
-- Set next secondary fire after your fire delay
self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
-- Set next primary fire after your fire delay
self.Weapon:EmitSound(self.Primary.Sound)
-- Emit the gun sound when you fire
self:RecoilPower()
self:TakePrimaryAmmo(1)
-- Take 1 ammo in you clip
if ((SinglePlayer() and SERVER) or CLIENT) then
self.Weapon:SetNetworkedFloat("LastShootTime", CurTime())
end
end
/---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------/
function SWEP:SecondaryAttack()
if self.NextSecondaryAttack > CurTime() or self.OwnerIsNPC then return end
self.NextSecondaryAttack = CurTime() + 0.3
if self.Owner:KeyDown(IN_USE) then
if self.mode == "semi" then
self.mode = "auto"
self.Weapon:SetNextSecondaryFire(CurTime() + 0.5)
else
self.mode = "semi"
self.Weapon:SetNextSecondaryFire(CurTime() + 0.5)
end
self.data[self.mode].Init(self)
if self.mode == "auto" then
self.Weapon:SetNetworkedInt("csef",1)
elseif self.mode == "semi" then
self.Weapon:SetNetworkedInt("csef",3)
end
/*---------------------------------------------------------
– All of this is more complicated than it needs to be. Oh well.
elseif self.IronSightsPos then
local NumberOfScopeZooms = table.getn(self.ScopeZooms)
if self.UseScope and self.Weapon:GetNetworkedBool("Scope", false) then
self.CurScopeZoom = self.CurScopeZoom + 1
if self.CurScopeZoom <= NumberOfScopeZooms then
self:SetIronsights(false,self.Owner)
end
else
local bIronsights = not self.Weapon:GetNetworkedBool("Ironsights", false)
self:SetIronsights(bIronsights,self.Owner)
end
---------------------------------------------------------*/
end
end
– Ironsight/Scope –
– IronSightsPos and IronSightsAng are model specific paramaters that tell the game where to move the weapon viewmodel in ironsight mode.
SWEP.IronSightsPos = Vector (-6.095, -13.3243, 1.2867)
SWEP.IronSightsAng = Vector (0, 0, 0.0251)
SWEP.IronSightZoom = 1.3 – How much the player’s FOV should zoom in ironsight mode.
SWEP.UseScope = true – Use a scope instead of iron sights.
SWEP.ScopeScale = 0.4 – The scale of the scope’s reticle in relation to the player’s screen size.
SWEP.ScopeZooms = {2} – The possible magnification levels of the weapon’s scope. If the scope is already activated, secondary fire will cycle through each zoom level in the table.
SWEP.DrawParabolicSights = false – Set to true to draw a cool parabolic sight (helps with aiming over