Hello I got theese fists from garrysmod.org and they work fine until I want to break vents on a map like jb_new_summer They do not do any damage to the vents at all. Would anybody be able to help me make them do damage on vents?
Fists Link: [url]http://www.garrysmod.org/downloads/?a=view&id=131267[/url]
Code From The Fists:
[lua]if (SERVER) then
AddCSLuaFile( "shared.lua" )
resource.AddFile("materials/vgui/entities/fists_weapon.vtf")
resource.AddFile("materials/vgui/entities/fists_weapon.vmt")
resource.AddFile("models/weapons/v_fists_t.dx80.vtx")
resource.AddFile("models/weapons/v_fists_t.dx90.vtx")
resource.AddFile("models/weapons/v_fists_t.mdl")
resource.AddFile("models/weapons/v_fists_t.sw.vtx")
resource.AddFile("models/weapons/v_fists_t.vvd")
resource.AddFile("models/weapons/v_fists_tt.dx90.vtx")
resource.AddFile("models/weapons/w_fists_t.dx80.vtx")
resource.AddFile("models/weapons/w_fists_t.dx90.vtx")
resource.AddFile("models/weapons/w_fists_t.mdl")
resource.AddFile("models/weapons/w_fists_t.phy")
resource.AddFile("models/weapons/w_fists_t.sw.vtx")
resource.AddFile("models/weapons/w_fists_t.vvd")
resource.AddFile("sound/weapons/Fist1.wav")
resource.AddFile("sound/weapons/Fist2.wav")
resource.AddFile("sound/weapons/Fist3.wav")
resource.AddFile("sound/weapons/Fist4.wav")
resource.AddFile("sound/weapons/Fistwall1.wav")
resource.AddFile("sound/weapons/Fistmiss1.wav")
resource.AddFile("sound/weapons/Fistmiss2.wav")
end
if (CLIENT) then
SWEP.CrossHairScale = 0
SWEP.ViewModelFOV = 62
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = false
end
SWEP.Base = "weapon_base"
SWEP.Author = "Serah Farron"
SWEP.Instructions = "Punch Players and props"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.PrintName = "Fists"
SWEP.Slot = 3
SWEP.SlotPos = 3
SWEP.ViewModel = "models/weapons/v_fists_t.mdl"
SWEP.WorldModel = "models/weapons/w_fists_t.mdl"
SWEP.ViewModelFlip = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.Ammo = "none"
SWEP.Primary.Automatic = false
SWEP.Primary.Damage = 0
SWEP.Primary.Delay = 0.2
SWEP.FistHit = "weapons/Fistwall1.wav"
SWEP.FistHitFlesh = { "weapons/Fist1.wav",
"weapons/Fist2.wav",
"weapons/Fist3.wav",
"weapons/Fist4.wav" }
SWEP.FistMiss = { "weapons/Fistmiss1.wav",
"weapons/Fistmiss2.wav" }
SWEP.HoldType = "fist"
SWEP.ViewPunch = Angle( -2, 0, 0 )
SWEP.Enabled = true
SWEP.AnimDeploy = nil
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
end
function SWEP:Precache()
util.PrecacheSound("weapons/Fist1.wav")
util.PrecacheSound("weapons/Fist2.wav")
util.PrecacheSound("weapons/Fist3.wav")
util.PrecacheSound("weapons/Fist4.wav")
util.PrecacheSound("weapons/Fistwall1.wav")
util.PrecacheSound("weapons/Fistmiss1.wav")
util.PrecacheSound("weapons/Fistmiss2.wav")
end
function SWEP:PrimaryAttack()
if !self:CanPrimaryAttack() then return end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:Punch( self.Primary.Damage, self.FistHit, self.FistHitFlesh, self.FistMiss )
end
function SWEP:SecondaryAttack()
if !self:CanSecondaryAttack() then return end
self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
self:Toggle()
end
function SWEP:Toggle()
if self.Enabled then
self.Enabled = false
self:SetWeaponHoldType( normal )
self.Owner:DrawViewModel( false )
else
self.Enabled = true
self:SetWeaponHoldType( self.HoldType )
self.Owner:DrawViewModel( true )
end
end
function SWEP:Punch( dmg, hitworld_sound, hitply_sound, miss_sound )
local trace = util.TraceHull({start=self.Owner:GetShootPos(),
endpos=self.Owner:GetShootPos() + self.Owner:GetAimVector() * 60,
mins=Vector(-8, -8, -8), maxs=Vector(8, 8, 8),
filter=self.Owner})
local sound = miss_sound
if trace.Hit then
if IsValid(trace.Entity) && ( trace.Entity:IsPlayer() || trace.Entity:IsNPC() ) then
sound = hitply_sound
else
sound = hitworld_sound
end
end
if sound && IsFirstTimePredicted() then
if type(sound) == "table" then
self.Weapon:EmitSound( sound[math.random(1, #sound)] )
else
self.Weapon:EmitSound( sound )
end
end
self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Owner:ViewPunch( self.ViewPunch )
if SERVER && IsValid( trace.Entity ) then
if ( trace.Entity:IsPlayer() || trace.Entity:IsNPC() ) then
trace.Entity:TakeDamage( self.Primary.Damage, self.Owner )
trace.Entity:SetVelocity( self.Owner:GetAimVector() * 768, 0 )
else
local phys = trace.Entity:GetPhysicsObject()
if IsValid(phys) then
phys:SetVelocity( self.Owner:GetVelocity() + (self.Owner:GetAimVector() * 1024) )
end
end
end
end
function SWEP:Deploy()
self.Enabled = true
self:SendWeaponAnim( self.AnimDeploy or ACT_VM_DRAW )
return true
end
function SWEP:Reload() return false end
function SWEP:CanPrimaryAttack() return true end
function SWEP:CanSecondaryAttack() return false end[/lua]
Any help would be appreciated.
Ummm, have you tried the default fists? they come with GMod and they're made by Robotboy
[QUOTE=jellofacey;42913806]Ummm, have you tried the default fists? they come with GMod and they're made by Robotboy[/QUOTE]
I actually think they don't work either.
Yeah they dont work..[QUOTE=Robotboy655;42913857]I actually think they don't work either.[/QUOTE]
You should be able to change this:
[code]if ( trace.Entity:IsPlayer() || trace.Entity:IsNPC() ) then[/code]
To
[code]if ( trace.Entity:IsPlayer( ) || trace.Entity:IsNPC( ) || trace.Entity:Health( ) > 0 ) then[/code]
And it should then damage props in addition to the vents.
Thank you so much! This works great![QUOTE=Kogitsune;42918113]You should be able to change this:
[code]if ( trace.Entity:IsPlayer() || trace.Entity:IsNPC() ) then[/code]
To
[code]if ( trace.Entity:IsPlayer( ) || trace.Entity:IsNPC( ) || trace.Entity:Health( ) > 0 ) then[/code]
And it should then damage props in addition to the vents.[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.