• Help With Murder Weapons!
    1 replies, posted
Good afternoon, I recently started a murder server and I customized it, I changed the names, and several other things. The problem is I changed the weapon models from Magnum to deagle and Knife to TTT knife. So it works great but I have two problems. When I kill someone with the gun or knife the player just disappears... If the player kills an innocent bystander with a gun it also doesn't drop. Here is the code for weapon_mu_knife [CODE]SWEP.ViewModel = "models/weapons/cstrike/c_knife_t.mdl" SWEP.WorldModel = "models/weapons/w_knife_t.mdl" SWEP.PrintName = "Shank" SWEP.Author = "Zachary Sutton" SWEP.Contact = "" SWEP.Purpose = "To kill them bystanders." SWEP.Instructions = "Weapon: 'CS:S Knife' Melee Attack: 'Left Click' Throw Knife: 'Right Click'" SWEP.Weight = 0 SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Primary.Delay = 0.5 SWEP.Primary.Recoil = 3 SWEP.Primary.Damage = 120 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.04 SWEP.Primary.ClipSize = -1 SWEP.Primary.Force = 10 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.UseHands = true SWEP.Primary.Ammo = "none" SWEP.Secondary.Delay = 0.9 SWEP.Secondary.Recoil = 0 SWEP.Secondary.Damage = 0 SWEP.Secondary.NumShots = 1 SWEP.Secondary.Cone = 0 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:GetTrace(ang) local trace = {} trace.filter = self.Owner trace.start = self.Owner:GetShootPos() trace.mask = MASK_SHOT local vec = self.Owner:GetAimVector() if ang then vec:Rotate(ang) end trace.endpos = trace.start + vec * 60 //trace.mask = MASK_SHOT local tr = util.TraceLine(trace) tr.TraceAimVector = vec tr.TraceAngle = ang return tr end function SWEP:PrimaryAttack() if self.FistCanAttack then return end if self.IdleTime && self.IdleTime > CurTime() then return end self.FistCanAttack = CurTime() + self.Primary.Delay self.Owner:SetAnimation( PLAYER_ATTACK1 ) self:SendWeaponAnim( ACT_VM_MISSCENTER ) self.FistHit = CurTime() + 0.1 end function SWEP:SecondaryAttack() if self.FistCanAttack then return end if self.IdleTime && self.IdleTime > CurTime() then return end self.FistCanAttack = CurTime() + self.Primary.Delay self.Owner:SetAnimation( PLAYER_ATTACK1 ) self:SendWeaponAnim( ACT_VM_HITCENTER ) if SERVER then local ent = ents.Create("mu_knife") ent:SetOwner(self.Owner) ent:SetPos(self.Owner:GetShootPos()) local knife_ang = Angle(-28,0,0) + self.Owner:EyeAngles() knife_ang:RotateAroundAxis(knife_ang:Right(), -90) ent:SetAngles(knife_ang) ent:Spawn() local phys = ent:GetPhysicsObject() phys:SetVelocity(self.Owner:GetAimVector() * 1000) phys:AddAngleVelocity(Vector(0, 1500, 0)) self:Remove() end end function SWEP:Think() if self.FistCanAttack && self.FistCanAttack < CurTime() then self.FistCanAttack = nil self:SendWeaponAnim( ACT_VM_IDLE ) self.IdleTime = CurTime() + 0.1 end if self.FistHit && self.FistHit < CurTime() then self.Owner:LagCompensation(true) self.FistHit = nil local tr = self:GetTrace() // aim around if !tr.Hit then tr = self:GetTrace(Angle(0,20,0)) end if !tr.Hit then tr = self:GetTrace(Angle(0,-20,0)) end if !tr.Hit then tr = self:GetTrace(Angle(0,0,20)) end if !tr.Hit then tr = self:GetTrace(Angle(0,0,-20)) end if tr.Hit then self.Owner:ViewPunch(Angle(0, 3, 0)) if IsValid(tr.Entity) then // only play the sound for the murderer if CLIENT && LocalPlayer() == self.Owner then self:EmitSound("Weapon_Crowbar.Melee_Hit") end else self:EmitSound("Weapon_Crowbar.Melee_Hit") end local bullet = {} -- Set up the shot bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = tr.TraceAimVector bullet.Spread = Vector( 0, 0, 0 ) bullet.Tracer = 0 bullet.Force = self.Primary.Force bullet.Damage = self.Primary.Damage self.Owner:FireBullets( bullet ) else // only play the sound for the murderer if CLIENT && LocalPlayer() == self.Owner then self:EmitSound("Weapon_Crowbar.Single") end end self.Owner:LagCompensation(false) end end[/CODE] and the code for weapon_mu_magnum: [CODE]if ( SERVER ) then AddCSLuaFile( "shared.lua" ) else killicon.AddFont( "weapon_mu_magnum", "HL2MPTypeDeath", "1", Color( 255, 0, 0 ) ) end SWEP.Base = "weapon_base" SWEP.PrintName = "Deagle" SWEP.Slot = 2 SWEP.SlotPos = 1 SWEP.DrawAmmo = true SWEP.DrawCrosshair = true SWEP.UseHands = true SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 54 SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl" SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" SWEP.HoldType = "pistol" SWEP.PKOneOnly = true SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Author = "Zachary Sutton" SWEP.Contact = "" SWEP.Purpose = "To kill them murders." SWEP.Instructions = "Weapon: 'Deagle' Shoot: 'Left Click' Reload: 'R'" SWEP.Icon = "VGUI/ttt/icon_deagle" SWEP.Primary.Sound = "Weapon_Deagle.Single" SWEP.Primary.Damage = 120 SWEP.Primary.NumShots = 1 SWEP.Primary.Recoil = 0.9 SWEP.Primary.Cone = 1 SWEP.Primary.Delay = 3 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Tracer = 1 SWEP.Primary.Force = 420 SWEP.Primary.TakeAmmoPerBullet = false SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Primary.ReloadTime = 2.6 SWEP.ReloadFinishedSound = Sound("Weapon_Crossbow.BoltElectrify") SWEP.ReloadSound = Sound("Weapon_Glock.Reload") SWEP.Secondary.Sound = "" SWEP.Secondary.Damage = 10 SWEP.Secondary.NumShots = 1 SWEP.Secondary.Recoil = 1 SWEP.Secondary.Cone = 0 SWEP.Secondary.Delay = 0.25 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Tracer = -1 SWEP.Secondary.Force = 5 SWEP.Secondary.TakeAmmoPerBullet = false SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" if SERVER then util.AddNetworkString("pkshotguncanattack") end function SWEP:Initialize() self:SetWeaponHoldType( self.HoldType ) self.CanAttack = true end function SWEP:BulletCallback(att, tr, dmg) return {effects = true,damage = true} end function SWEP:PrimaryAttack() if !self.CanAttack then return false end local bullet = {} -- Set up the shot bullet.Num = self.Primary.NumShots bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( self.Primary.Cone / 90, self.Primary.Cone / 90, 0 ) bullet.Tracer = self.Primary.Tracer bullet.Force = self.Primary.Force bullet.Damage = self.Primary.Damage -- function bullet.Callback(att,tr,dmg) -- self:BulletCallback(att, tr, dmg) -- end self.Owner:FireBullets( bullet ) self:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) self:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch(Angle( -self.Primary.Recoil, 0, 0 )) self.NextLower = CurTime() + 0.4 self.CanAttack = false // hacky fix for client, don't send immediately timer.Simple(0, function () if IsValid(self) then self:NetCanAttack() end end) end function SWEP:SecondaryAttack() end function SWEP:Think() if self.NextAttack && self.NextAttack < CurTime() then self.NextAttack = nil self.CanAttack = true self:NetCanAttack() //self:SendWeaponAnim( ACT_VM_IDLE) //self.Owner:ChatPrint("Cake") end if self.NextLower && self.NextLower < CurTime() then self.NextLower = nil self.NextUpper = CurTime() + self.Primary.ReloadTime self:SendWeaponAnim(ACT_VM_RELOAD) -- self:EmitSound(self.ReloadSound) local i = math.random(1,3) if i == 2 then i = 4 end self:EmitSound("weapons/357/357_reload" .. i .. ".wav") self.Owner:SetAnimation( PLAYER_RELOAD ) end if self.NextUpper && self.NextUpper < CurTime() then self.NextUpper = nil self.
What a misleading thread name. [editline]2nd February 2014[/editline] & Nvm, didn't see it was in scripting section.
Sorry, you need to Log In to post a reply to this thread.