Created
April 24, 2017 02:24
-
-
Save schlarpc/41ef6a9036e579beb6cdf29b4e2a65cc to your computer and use it in GitHub Desktop.
todeagle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if SERVER then | |
AddCSLuaFile("shared.lua") | |
require("cvar2") | |
cvar2.SetFlags("sv_cheats", FCVAR_REPLICATED) | |
end | |
if CLIENT then | |
SWEP.PrintName = "Totally Ordinary Deagle" | |
SWEP.Author = "schlarpc" | |
SWEP.Slot = 6 | |
SWEP.ViewModelFOV = 72 | |
SWEP.ViewModelFlip = true | |
end | |
SWEP.Base = "weapon_tttbase" | |
-- Standard SWEP config | |
SWEP.HoldType = "pistol" | |
SWEP.Primary.Sound = "ttt/todeagle.wav" | |
SWEP.Primary.Recoil = 6.0 | |
SWEP.Primary.RecoilXRand = 1.5 | |
SWEP.Primary.RecoilYRand = 0.1 | |
SWEP.Primary.Damage = 1000 | |
SWEP.Primary.Force = 1000 | |
SWEP.Primary.NumShots = 1 | |
SWEP.Primary.Cone = 0 | |
SWEP.Primary.Delay = 1.5 | |
SWEP.Primary.ClipSize = 1 | |
SWEP.Primary.DefaultClip = 1 | |
SWEP.Primary.ClipMax = 1 | |
SWEP.Primary.Automatic = false | |
SWEP.HeadshotMultiplier = 10 | |
SWEP.IronSightsPos = Vector(5.15, -2, 2.6) | |
SWEP.IronSightsAng = Vector(0, 0, 0) | |
SWEP.ViewModel = "models/weapons/v_pist_deagle.mdl" | |
SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" | |
-- TTT specific configuration | |
SWEP.Kind = WEAPON_EQUIP2 | |
SWEP.Icon = "vgui/ttt/icon_deagle" | |
SWEP.CanBuy = {ROLE_TRAITOR} | |
SWEP.LimitedStock = true | |
SWEP.EquipMenuData = {type = "Weapon", desc = "A normal Deagle."} | |
SWEP.AllowDrop = true | |
SWEP.IsSilent = false | |
SWEP.AutoSpawnable = false | |
-- Weapon code | |
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 = self.TracerFreq | |
bullet.Force = self.ForceApply | |
bullet.Damage = dmg | |
self.Owner:FireBullets(bullet) | |
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) | |
self.Owner:MuzzleFlash() | |
self.Owner:SetAnimation(PLAYER_ATTACK1) | |
end | |
function SWEP:PrimaryAttack() | |
if (!self:CanPrimaryAttack()) then return end | |
if SERVER then | |
require("cvar2") | |
cvar2.SetValue("sv_cheats", "1") | |
timer.Simple(3.15, cvar2.SetValue, "host_timescale", "1") | |
timer.Simple(3.16, cvar2.SetValue, "sv_cheats", "0") | |
timer.Simple(0.00, cvar2.SetValue, "host_timescale", "0.1") | |
end | |
self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay) | |
self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay) | |
if (!self:CanPrimaryAttack()) then return end | |
self.Weapon:EmitSound(self.Primary.Sound, 500, 100) | |
self:CSShootBullet(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone) | |
self:TakePrimaryAmmo(1) | |
self.Owner:ViewPunch(Angle(math.Rand(-self.Primary.RecoilXRand, -self.Primary.RecoilXRand) * self.Primary.Recoil, math.Rand(self.Primary.RecoilYRand, -self.Primary.RecoilYRand) * self.Primary.Recoil, 0)) | |
end | |
resource.AddFile("sound/ttt/todeagle.wav") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment