• Looking for SWEP bases.
    3 replies, posted
Hi I am looking for SWEP bases like this one [URL="http://gamebanana.com/wips/39845"]here[/URL] and is unable to find a similar one like it. So if anyone as any idea where to find tutorials covering the features of the SWEP base or knows anywhere to get a similar one, please reply. Thanks in advance.
The best way would be editing the old default swep base. Problem is that gmod does not have the CS:S sweps anymore. You can extract the flechette weapon from gmod's gcf and edit it. I can give you some directions if you want to create CS:S style sweps as I have made my little swep base before the 13 update. Add me on steam.
You could try using the one from VorteX's Weaponry, it's decent, basic and works great for CS:S weapons since I think it is essentially the original base editied a bit. [lua] if SERVER then AddCSLuaFile() SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false end if CLIENT then SWEP.DrawAmmo = true SWEP.DrawCrosshair = true SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = true SWEP.CSMuzzleFlashes = true SWEP.DrawWeaponInfoBox = false end SWEP.VorteXWeapon = true SWEP.SupportsSilencer = false SWEP.SpecialUsing = false SWEP.Author = "VorteX" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Category = "VorteX's Weaponry" SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Ironsight_Time = 0.33 SWEP.HoldType = "pistol" SWEP.IronHoldType = "revolver" SWEP.Pistol = false SWEP.Rifle = false SWEP.Shotgun = false SWEP.SMG = false SWEP.Melee = false SWEP.Sniper = false SWEP.Primary.Sound = Sound("Weapon_AK47.Single") SWEP.Primary.SilencedSound = Sound("Weapon_AK47.Single") SWEP.Primary.Recoil = 1.5 SWEP.Primary.Damage = 40 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.RPM = 800 SWEP.Primary.Delay = 0.15 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:GetIronsights() return self.Weapon:GetNetworkedBool("Ironsights", false) end function SWEP:GetSilenced() return self.Weapon:GetNetworkedBool("Silencer", false) end function SWEP:GetPrimaryDelay() if self.Primary.RPM != nil then return 1 / ( self.Primary.RPM / 60 ) end return self.Primary.Delay end function SWEP:GetPrimarySound() if self:GetSilenced() then return self.Primary.SilencedSound else return self.Primary.Sound end end function SWEP:OwnerIsRunning() return self.Owner:KeyDown(IN_SPEED) end function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) self.Weapon:SetNetworkedBool("Ironsights", false) self.Weapon:SetNetworkedBool("Silencer", false) end function SWEP:Reload() if self:GetSilenced() then self.Weapon:DefaultReload(ACT_VM_RELOAD_SILENCED) else self.Weapon:DefaultReload(ACT_VM_RELOAD) end self:SetIronsights(false) end function SWEP:Deploy() if self:GetSilenced() then self.Weapon:SendWeaponAnim(ACT_VM_DRAW_SILENCED) else self.Weapon:SendWeaponAnim(ACT_VM_DRAW) end self.Weapon:SetNextPrimaryFire(CurTime() + 1) end function SWEP:Think() if self.Owner:KeyDown(IN_USE) and self.Owner:KeyDown(IN_ATTACK2) and !self.SpecialUsing then self:SetIronsights(false) self.SpecialUsing = true if self:GetSilenced() then self.Weapon:SetNetworkedBool("Silencer", false) self.Weapon:SendWeaponAnim(ACT_VM_DETACH_SILENCER) self.Weapon:SetNextPrimaryFire(CurTime() + 3) else self.Weapon:SetNetworkedBool("Silencer", true) self.Weapon:SendWeaponAnim(ACT_VM_ATTACH_SILENCER) self.Weapon:SetNextPrimaryFire(CurTime() + 3) end elseif !self.Owner:KeyDown(IN_USE) or !self.Owner:KeyDown(IN_ATTACK2) then self.SpecialUsing = false end end function SWEP:CanPrimaryAttack() if self.Weapon:Clip1() <= 0 then return false end return true end function SWEP:PrimaryAttack() -- self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) -- self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self:GetPrimaryDelay() ) self.Weapon:SetNextPrimaryFire( CurTime() + self:GetPrimaryDelay() ) if !self:CanPrimaryAttack() then // weapons/pistol/pistol_empty.wav // weapons/shotgun/shotgun_empty.wav // Weapons/ClipEmpty_Pistol.wav local snd = "Weapons/ClipEmpty_Pistol.wav" if self.Shotgun then snd = "weapons/shotgun/shotgun_empty.wav" end self:EmitSound(snd) if self.Primary.Automatic then // so realistic! self.Weapon:SetNextPrimaryFire(CurTime() + 0.5) end return end self.Weapon:EmitSound(self:GetPrimarySound()) self:CSShootBullet(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone) self:TakePrimaryAmmo(1) local topunch = Angle( math.Rand(-0.5,-0.5) * self.Primary.Recoil, math.Rand(-0.5,0.5) * self.Primary.Recoil, math.Rand(-0.09, 0.09) * self.Primary.Recoil ) if self.Weapon:GetNetworkedBool("Ironsights", false) then self.Owner:ViewPunch(topunch) else self.Owner:ViewPunch(topunch * 1.5) end // custom recoil, stolen from css base if ( (game.SinglePlayer() and SERVER) or ( !game.SinglePlayer() and CLIENT and IsFirstTimePredicted() ) ) then local eyeang = self.Owner:EyeAngles() eyeang.pitch = eyeang.pitch - self.Primary.Recoil eyeang.yaw = eyeang.yaw - math.random(self.Primary.Recoil * -0.5, self.Primary.Recoil / 2) self.Owner:SetEyeAngles( eyeang ) end end function SWEP:CSShootBullet(dmg, recoil, numbul, cone) numbul = numbul or 1 cone = cone or 0.01 local bullet = {} bullet.Num = numbul bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( cone, cone, 0 ) bullet.Tracer = 1 bullet.Force = 20 bullet.Damage = dmg self.Owner:FireBullets(bullet) if self:GetSilenced() then self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK_SILENCED) else self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) end self.Owner:MuzzleFlash() self.Owner:SetAnimation(PLAYER_ATTACK1) end function SWEP:GetViewModelPosition(pos, ang) if !self.IronSightsPos then return pos, ang end local bIron = self.Weapon:GetNetworkedBool("Ironsights") if bIron != self.bLastIron then self.bLastIron = bIron self.fIronTime = CurTime() if bIron then self.SwayScale = 0.3 if self.Pistol then self.SwayScale = 0.3 elseif self.Rifle then self.SwayScale = 1.66 elseif self.Shotgun then self.SwayScale = 1.83 elseif self.SMG then self.SwayScale = 1 end self.BobScale = 0.1 else self.SwayScale = 2.5 if self.Pistol then self.SwayScale = 1 elseif self.Rifle then self.SwayScale = 5 elseif self.Shotgun then self.SwayScale = 5.5 elseif self.SMG then self.SwayScale = 3 end self.BobScale = 1 end end local fIronTime = self.fIronTime or 0 if !bIron and fIronTime < CurTime() - self.Ironsight_Time then return pos, ang end local Mul = 1.0 if ( fIronTime > CurTime() - self.Ironsight_Time ) then Mul = math.Clamp( (CurTime() - fIronTime) / self.Ironsight_Time, 0, 1 ) if (!bIron) then Mul = 1 - Mul end end local Offset = self.IronSightsPos if ( self.IronSightsAng ) then ang = ang * 1 ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul ) ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul ) ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul ) end local Right = ang:Right() local Up = ang:Up() local Forward = ang:Forward() pos = pos + Offset.x * Right * Mul pos = pos + Offset.y * Forward * Mul pos = pos + Offset.z * Up * Mul return pos, ang end function SWEP:SetIronsights(bool) if bool then self.Weapon:SetWeaponHoldType(self.IronHoldType) else self.Weapon:SetWeaponHoldType(self.HoldType) end self.DrawCrosshair = !bool self.Weapon:SetNetworkedBool("Ironsights", bool) end SWEP.NextSecondaryAttack = 0 function SWEP:SecondaryAttack() if self.SpecialUsing then return end if !self.IronSightsPos then return end if self.NextSecondaryAtta
[QUOTE=KillerLUA;39104692]You could try using the one from VorteX's Weaponry, it's decent, basic and works great for CS:S weapons since I think it is essentially the original base editied a bit. [lua] if SERVER then AddCSLuaFile() SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false end if CLIENT then SWEP.DrawAmmo = true SWEP.DrawCrosshair = true SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = true SWEP.CSMuzzleFlashes = true SWEP.DrawWeaponInfoBox = false end SWEP.VorteXWeapon = true SWEP.SupportsSilencer = false SWEP.SpecialUsing = false SWEP.Author = "VorteX" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Category = "VorteX's Weaponry" SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Ironsight_Time = 0.33 SWEP.HoldType = "pistol" SWEP.IronHoldType = "revolver" SWEP.Pistol = false SWEP.Rifle = false SWEP.Shotgun = false SWEP.SMG = false SWEP.Melee = false SWEP.Sniper = false SWEP.Primary.Sound = Sound("Weapon_AK47.Single") SWEP.Primary.SilencedSound = Sound("Weapon_AK47.Single") SWEP.Primary.Recoil = 1.5 SWEP.Primary.Damage = 40 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.RPM = 800 SWEP.Primary.Delay = 0.15 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:GetIronsights() return self.Weapon:GetNetworkedBool("Ironsights", false) end function SWEP:GetSilenced() return self.Weapon:GetNetworkedBool("Silencer", false) end function SWEP:GetPrimaryDelay() if self.Primary.RPM != nil then return 1 / ( self.Primary.RPM / 60 ) end return self.Primary.Delay end function SWEP:GetPrimarySound() if self:GetSilenced() then return self.Primary.SilencedSound else return self.Primary.Sound end end function SWEP:OwnerIsRunning() return self.Owner:KeyDown(IN_SPEED) end function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) self.Weapon:SetNetworkedBool("Ironsights", false) self.Weapon:SetNetworkedBool("Silencer", false) end function SWEP:Reload() if self:GetSilenced() then self.Weapon:DefaultReload(ACT_VM_RELOAD_SILENCED) else self.Weapon:DefaultReload(ACT_VM_RELOAD) end self:SetIronsights(false) end function SWEP:Deploy() if self:GetSilenced() then self.Weapon:SendWeaponAnim(ACT_VM_DRAW_SILENCED) else self.Weapon:SendWeaponAnim(ACT_VM_DRAW) end self.Weapon:SetNextPrimaryFire(CurTime() + 1) end function SWEP:Think() if self.Owner:KeyDown(IN_USE) and self.Owner:KeyDown(IN_ATTACK2) and !self.SpecialUsing then self:SetIronsights(false) self.SpecialUsing = true if self:GetSilenced() then self.Weapon:SetNetworkedBool("Silencer", false) self.Weapon:SendWeaponAnim(ACT_VM_DETACH_SILENCER) self.Weapon:SetNextPrimaryFire(CurTime() + 3) else self.Weapon:SetNetworkedBool("Silencer", true) self.Weapon:SendWeaponAnim(ACT_VM_ATTACH_SILENCER) self.Weapon:SetNextPrimaryFire(CurTime() + 3) end elseif !self.Owner:KeyDown(IN_USE) or !self.Owner:KeyDown(IN_ATTACK2) then self.SpecialUsing = false end end function SWEP:CanPrimaryAttack() if self.Weapon:Clip1() <= 0 then return false end return true end function SWEP:PrimaryAttack() -- self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) -- self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self:GetPrimaryDelay() ) self.Weapon:SetNextPrimaryFire( CurTime() + self:GetPrimaryDelay() ) if !self:CanPrimaryAttack() then // weapons/pistol/pistol_empty.wav // weapons/shotgun/shotgun_empty.wav // Weapons/ClipEmpty_Pistol.wav local snd = "Weapons/ClipEmpty_Pistol.wav" if self.Shotgun then snd = "weapons/shotgun/shotgun_empty.wav" end self:EmitSound(snd) if self.Primary.Automatic then // so realistic! self.Weapon:SetNextPrimaryFire(CurTime() + 0.5) end return end self.Weapon:EmitSound(self:GetPrimarySound()) self:CSShootBullet(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone) self:TakePrimaryAmmo(1) local topunch = Angle( math.Rand(-0.5,-0.5) * self.Primary.Recoil, math.Rand(-0.5,0.5) * self.Primary.Recoil, math.Rand(-0.09, 0.09) * self.Primary.Recoil ) if self.Weapon:GetNetworkedBool("Ironsights", false) then self.Owner:ViewPunch(topunch) else self.Owner:ViewPunch(topunch * 1.5) end // custom recoil, stolen from css base if ( (game.SinglePlayer() and SERVER) or ( !game.SinglePlayer() and CLIENT and IsFirstTimePredicted() ) ) then local eyeang = self.Owner:EyeAngles() eyeang.pitch = eyeang.pitch - self.Primary.Recoil eyeang.yaw = eyeang.yaw - math.random(self.Primary.Recoil * -0.5, self.Primary.Recoil / 2) self.Owner:SetEyeAngles( eyeang ) end end function SWEP:CSShootBullet(dmg, recoil, numbul, cone) numbul = numbul or 1 cone = cone or 0.01 local bullet = {} bullet.Num = numbul bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( cone, cone, 0 ) bullet.Tracer = 1 bullet.Force = 20 bullet.Damage = dmg self.Owner:FireBullets(bullet) if self:GetSilenced() then self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK_SILENCED) else self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) end self.Owner:MuzzleFlash() self.Owner:SetAnimation(PLAYER_ATTACK1) end function SWEP:GetViewModelPosition(pos, ang) if !self.IronSightsPos then return pos, ang end local bIron = self.Weapon:GetNetworkedBool("Ironsights") if bIron != self.bLastIron then self.bLastIron = bIron self.fIronTime = CurTime() if bIron then self.SwayScale = 0.3 if self.Pistol then self.SwayScale = 0.3 elseif self.Rifle then self.SwayScale = 1.66 elseif self.Shotgun then self.SwayScale = 1.83 elseif self.SMG then self.SwayScale = 1 end self.BobScale = 0.1 else self.SwayScale = 2.5 if self.Pistol then self.SwayScale = 1 elseif self.Rifle then self.SwayScale = 5 elseif self.Shotgun then self.SwayScale = 5.5 elseif self.SMG then self.SwayScale = 3 end self.BobScale = 1 end end local fIronTime = self.fIronTime or 0 if !bIron and fIronTime < CurTime() - self.Ironsight_Time then return pos, ang end local Mul = 1.0 if ( fIronTime > CurTime() - self.Ironsight_Time ) then Mul = math.Clamp( (CurTime() - fIronTime) / self.Ironsight_Time, 0, 1 ) if (!bIron) then Mul = 1 - Mul end end local Offset = self.IronSightsPos if ( self.IronSightsAng ) then ang = ang * 1 ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul ) ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul ) ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul ) end local Right = ang:Right() local Up = ang:Up() local Forward = ang:Forward() pos = pos + Offset.x * Right * Mul pos = pos + Offset.y * Forward * Mul pos = pos + Offset.z * Up * Mul return pos, ang end function SWEP:SetIronsights(bool) if bool then self.Weapon:SetWeaponHoldType(self.IronHoldType) else self.Weapon:SetWeaponHoldType(self.HoldType) end self.DrawCrosshair = !bool self.Weapon:SetNetworkedBool("Ironsights", bool) end SWEP.NextSecondaryAttack = 0 function SWEP:SecondaryAttack() if self.SpecialUsing then return end if !self.IronSightsPos then return end
Sorry, you need to Log In to post a reply to this thread.