hello
when i shot down a door with a css shotgun, it didn't respawn. di a bit of searching on the forum and foud this
[url]http://facepunch.com/showthread.php?t=1226213&p=38467620&viewfull=1#post38467620[/url]
it works but i am getting this error in console
[IMG]http://sc-cdn.scaleengine.net/i/9781d3cc5344f3197dee4987d5291710.png[/IMG]
how can i fix this? i dont like errors filling up my console.
the shotgun code:
[CODE]-- CAN THE SHOTGUN DESTROY DOORS WITH THE BUCKSHOT ROUNDS? 1 = YES, 0 = NO
SWEP.DestroyDoor = 1
--------------------------------------------------------------------------
-- Read the weapon_real_base if you really want to know what each action does
/*---------------------------------------------------------*/
local HitImpact = function(attacker, tr, dmginfo)
local hit = EffectData()
hit:SetOrigin(tr.HitPos)
hit:SetNormal(tr.HitNormal)
hit:SetScale(20)
util.Effect("effect_hit", hit)
return true
end
/*---------------------------------------------------------*/
if (SERVER) then
AddCSLuaFile("shared.lua")
end
if (CLIENT) then
SWEP.PrintName = "BENELLI M3 SUPER 90"
SWEP.Slot = 3
SWEP.SlotPos = 1
SWEP.IconLetter = "k"
killicon.AddFont("weapon_real_cs_pumpshotgun", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ))
end
/*---------------------------------------------------------
Muzzle Effect + Shell Effect
---------------------------------------------------------*/
SWEP.MuzzleEffect = "rg_muzzle_grenade" -- 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 = "rg_shelleject_shotgun" -- This is a shell ejection effect
-- Available shell eject effects: rg_shelleject, rg_shelleject_rifle, rg_shelleject_shotgun, none
SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models
SWEP.ShellEjectAttachment = "2" -- Should be "2" for CSS models or "1" for hl2 models
SWEP.EjectDelay = 0.53
/*-------------------------------------------------------*/
local DoorSound = Sound("physics/wood/wood_box_impact_hard3.wav")
local ShotgunReloading
ShotgunReloading = false
SWEP.Instructions = "Buckshot Damage (Per buckshot lead): 9% \nSlug Damage (Per slug): 88% \nRecoil: 50% \nBuckshot Precision: 55% \nSlug Precision: 85% \nType: Pump-Action \n\nChange Mode: E + Right Click"
SWEP.Category = "CS:S Realistic Weapons" -- Swep Categorie (You can type what your want)
SWEP.Base = "weapon_real_base_pistol"
SWEP.HoldType = "shotgun"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl"
SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl"
SWEP.Primary.Sound = Sound("Weapon_M3.Single")
SWEP.Primary.Recoil = 5
SWEP.Primary.Damage = 9
SWEP.Primary.NumShots = 12
SWEP.Primary.Cone = 0.045
SWEP.Primary.ClipSize = 8
SWEP.Primary.Delay = 0.95
SWEP.Primary.DefaultClip = 8
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "buckshot"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector(-7.64, -9.2, 3.48)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.data = {}
SWEP.mode = "burst" -- Start with the buckshot rounds
SWEP.data.burst = {} -- Buckshot Rounds
SWEP.data.burst.Cone = 0.045 -- Cone of the buckshot rounds
SWEP.data.burst.NumShots = 12 -- 12 little leads
SWEP.data.burst.Damage = 9 -- Damage of a lead
SWEP.data.semi = {} -- Slug Rounds
SWEP.data.semi.Cone = 0.015 -- Cone of the slug rounds
SWEP.data.semi.NumShots = 1 -- 1 big lead
SWEP.data.semi.Damage = 88 -- Damage of the big lead
/*---------------------------------------------------------
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 ((game.SinglePlayer() and SERVER) or CLIENT) then
self.Weapon:SetNetworkedFloat("LastShootTime", CurTime())
end
end
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
if self.Owner:KeyDown(IN_USE) then
if self.mode == "semi" then
self.mode = "burst"
self.Owner:PrintMessage( HUD_PRINTCENTER, "Buckshot Rounds" )
self.Weapon:SetNextSecondaryFire(CurTime() + 1)
self.Weapon:SetNextPrimaryFire(CurTime() + 1)
self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
timer.Simple(0.3, function() self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) end)
else
self.mode = "semi"
self.Owner:PrintMessage( HUD_PRINTCENTER, "Slug Rounds" )
self.Weapon:SetNextSecondaryFire(CurTime() + 1)
self.Weapon:SetNextPrimaryFire(CurTime() + 1)
self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
timer.Simple(0.3, function() self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) end)
end
self.data[self.mode].Init(self)
elseif SERVER then
end
end
/*---------------------------------------------------------
Deploy
---------------------------------------------------------*/
function SWEP:Deploy()
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-- Set the deploy animation when deploying
self:SetIronsights( false )
-- Set the ironsight mod to false
self.Weapon:SetNextPrimaryFire(CurTime() + 1)
-- Set the next primary fire to 1 second after deploying
ShotgunReloading = false
self.Weapon:SetNetworkedBool( "reloading", false)
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-- Set the deploy animation when deploying
self:SetIronsights( false )
-- Set the ironsight mod to false
self.Weapon:SetNextPrimaryFire(CurTime() + 1)
-- Set the next primary fire to 1 second after deploying
self.Reloadaftershoot = CurTime() + 1
return true
end
/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:Reload()
if ( self.Reloadaftershoot > CurTime() ) then return end
if (self.Weapon:GetNWBool("reloading", false)) or ShotgunReloading then return end
if (self.Weapon:Clip1() < self.Primary.ClipSize and self.Owner:GetAmmoCount(self.Primary.Ammo) > 0) then
ShotgunReloading = true
self.Weapon:SetNextPrimaryFire(CurTime() + 0.5)
self.Weapon:SetNextSecondaryFire(CurTime() + 0.5)
self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
timer.Simple(0.3, function()
ShotgunReloading = false
self.Weapon:SetNetworkedBool("reloading", true)
self.Weapon:SetVar("reloadtimer", CurTime() + 1)
self.Weapon:SetNextPrimaryFire(CurTime() + 0.5)
self.Weapon:SetNextSecondaryFire(CurTime() + 0.5)
end)
end
self.Owner:SetFOV( 0, 0.15 )
-- Zoom = 0
self:SetIronsights(false)
-- Set the ironsight to false
end
/*---------------------------------------------------------
Think
---------------------------------------------------------*/
function SWEP:Think()
if self.Weapon:Clip1() > self.Primary.ClipSize then
self.Weapon:SetClip1(self.Primary.ClipSize)
end
if self.Weapon:GetNetworkedBool( "reloading") == true then
if self.Weapon:GetNetworkedInt( "reloadtimer") < CurTime() then
if self.unavailable then return end
if ( self.Weapon:Clip1() >
Lua help is that way: [url]http://facepunch.com/forums/65[/url]
Sorry, you need to Log In to post a reply to this thread.