• [Murder] Custom knife can't kill target who are moving
    4 replies, posted
Hey, i own a murder and i'm trying to custom the gamemode, i added some addon but i have a problem with the new knife that i want to add : When the murderer chase his victim, he can hit him but the victim don't lose any health and don't die. Anyone know what should i add/change to make it work? (i already increased the damage -> nope and the bullet.force -> nope) PS: Sorry for my english, i'm french ^^
Show your code...
Last time i posted it, i got ban for that, cause it's REALLY REALLY long [code]if (SERVER) then AddCSLuaFile( "shared.lua" ) SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false local ActIndex = {} ActIndex[ "knife" ] = ACT_HL2MP_IDLE_KNIFE //I wouldn't touch this. function SWEP:SetWeaponHoldType( t ) //Or this. local index = ActIndex[ t ] //Or any of this. Okay you get the point. if (index == nil) then return end self.ActivityTranslate = {} self.ActivityTranslate [ ACT_HL2MP_IDLE ] = index self.ActivityTranslate [ ACT_HL2MP_WALK ] = index + 1 self.ActivityTranslate [ ACT_HL2MP_RUN ] = index + 2 self.ActivityTranslate [ ACT_HL2MP_IDLE_CROUCH ] = index + 3 self.ActivityTranslate [ ACT_HL2MP_WALK_CROUCH ] = index + 4 self.ActivityTranslate [ ACT_HL2MP_GESTURE_RANGE_ATTACK ] = index + 5 self.ActivityTranslate [ ACT_HL2MP_GESTURE_RELOAD ] = index + 6 self.ActivityTranslate [ ACT_HL2MP_JUMP ] = index + 7 self.ActivityTranslate [ ACT_RANGE_ATTACK1 ] = index + 8 //Because we need animations self:SetupWeaponHoldTypeForAI( t ) end end if ( CLIENT ) then SWEP.PrintName = "Crescent Rose" //Name of the SWEP SWEP.DrawAmmo = false //Knives don't use ammo! SWEP.DrawCrosshair = false //Because we already got one. SWEP.ViewModelFOV = 60 //Field of View, lower is closer, higher is farther. SWEP.ViewModelFlip = false //Flip the model? Generally used for CS:S models but that's obsolete now. SWEP.CSMuzzleFlashes = false //Does a knife have a gun barrel? I think not. SWEP.Slot = 1 //Where does this weapon go? Where the crowbar goes, that's where! SWEP.SlotPos = 1 //Place it at slot 1, if possible. SWEP.IconLetter = "j" //What letter this uses for a killicon. Don't touch this, unless you know what letters are bound to what guns. killicon.AddFont("weapon_rubyrose_scythe", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 )) //Sexy KillIcon. Too bad I don't know how to make a custom one work. surface.CreateFont("CSKillIcons", {font = "csd", size = ScreenScale(30), weight = 500, antialias = true, additive = true}) surface.CreateFont("CSSelectIcons", {font = "csd", size = ScreenScale(60), weight = 500, antialias = true, additive = true}) end SWEP.Category = "RWBY" //Where the SWEP is in the spawn menu. SWEP.HoldType = "melee2" //How we hold this weapon. SWEP.Spawnable = true //Can anyone spawn it? SWEP.AdminSpawnable = true //Can admins only spawn it? SWEP.ViewModel = "models/weapons/cstrike/c_knife_t.mdl" //The model shown on your screen in first person. SWEP.WorldModel = "models/weapons/w_knife_t.mdl" //The model everyone else sees on screen. No point changing this, the model is replaced on obtaining this weapon. SWEP.UseHands = true //Use C Models, basically hands that look like your model's hands. Custom models require custom hands. SWEP.ShowViewModel = true //Show the view model? KEEP THIS TRUE AT ALL TIMES, IF DISABLED, ON WEAPON SWITCH ALL VIEWMODELS, INCLUDING EVERY GUN, WILL BE INVISIBLE!! SWEP.ShowWorldModel = false //Show the world model? SWEP.Weight = 5 //How tough this weapon is, for auto weapon switching. No point enabling this, autoswitch to and from is disabled. SWEP.AutoSwitchTo = false //Switch to this weapon if weight is higher then the one we have in hand? SWEP.AutoSwitchFrom = false //Allow other weapons to auto switch this gun, if it's weight is higher? SWEP.Primary.ClipSize = -1 //This is a knife. No need for ammo. SWEP.Primary.Damage = 75 //Don't touch this, instead goto line 144. SWEP.Primary.DefaultClip = -1 //This is a knife, how could it hold clips? SWEP.Primary.Automatic = true //Instead of clicking like a maniac, you can hold the mouse button. SWEP.Primary.Ammo ="none" //Once again, this is a knife... SWEP.WElements = { ["element_name"] = { type = "Model", model = "models/rubyscythe.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.596, 0, 0), angle = Angle(180, -180, 0), size = Vector(1.149, 1.149, 1.149), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } //WElements puts the scythe on the world model, so others see it. SWEP.VElements = { ["scythe"] = { type = "Model", model = "models/rubyscythe.mdl", bone = "v_weapon.Knife_Handle", rel = "", pos = Vector(-0.151, -1, -1), angle = Angle(0, -90, 0), size = Vector(0.699, 0.699, 0.699), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } //VElements puts the scythe on the view model, so you can see it. SWEP.Secondary.ClipSize = -1 //These are all obsolete, so don't fiddle with these. SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Damage = 200 SWEP.Secondary.Automatic = false SWEP.MissSound = Sound("weapons/knife/knife_slash1.wav") //Play this sound when we miss. SWEP.WallSound = Sound("weapons/knife/knife_hitwall1.wav") //Play this sound when we hit a wall. No, knives can't break down walls, silly. SWEP.DeploySound = Sound("weapons/knife/knife_deploy1.wav") //Play this sound when we take out this bad boy! /*--------------------------------------------------------- Think does nothing ---------------------------------------------------------*/ function SWEP:Think() end /*--------------------------------------------------------- Deploy plays the animation and draw sound ---------------------------------------------------------*/ function SWEP:Deploy() self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) self.Weapon:SetNextPrimaryFire(CurTime() + 1) //Delay using this weapon for one second so we can play the animation. self.Weapon:EmitSound( self.DeploySound, 50, 100 ) return true end /*--------------------------------------------------------- PrimaryAttack activated when we attack! ---------------------------------------------------------*/ function SWEP:PrimaryAttack() vm = self.Owner:GetViewModel() //This is in place so we can always do a slashing animation. Do you want to hit an enemy with the back side of your scythe? I don't think so. local tr = {} tr.start = self.Owner:GetShootPos() tr.endpos = self.Owner:GetShootPos() + ( self.Owner:GetAimVector() * 90 ) //90 is our range, higher means farther, lower is closer. tr.filter = self.Owner tr.mask = MASK_SHOT local trace = util.TraceLine( tr ) self.Weapon:SetNextPrimaryFire(CurTime() + 0.70) //Add delay when we swing. If this wasn't in place, we'd swing 64 times a second, one per tick! self.Owner:SetAnimation( PLAYER_ATTACK1 ) //Plays the attack animation on the player's thirdperson model. if ( trace.Hit ) then if trace.Entity:IsPlayer() or string.find(trace.Entity:GetClass(),"npc") or string.find(trace.Entity:GetClass(),"prop_ragdoll" ) then //Find what we're hitting. If it matches any of these, run this snippet of code. self.Weapon:SendWeaponAnim( ACT_VM_IDLE ) //Act all idle and stuff. vm:SetSequence(vm:LookupSequence("midslash2")) //Slash at it! bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1000 bullet.Damage = 120 //Damage it! self.Owner:FireBullets(bullet) self.Weapon:EmitSound( "weapons/knife/knife_hit" .. math.random(1, 4) .. ".wav" ) //Play the slash sound! else self.Weapon:SendWeaponAnim( ACT_VM_IDLE ) vm:SetSequence(vm:LookupSequence("midslash2")) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1000 bullet.Damage = 95 self.Owner:FireBullets(bullet) self.Weapon:EmitSound( self.WallSound ) util.Decal("ManhackCut", trace.HitPos + trace.HitNormal, trace.HitPos - trace.HitNormal) //Paint a nice cut on where we slashed at. end else self.Weapon:EmitSound(self.MissSound,100,math.rand om(90,120)) //Play a miss sound. self.Weapon:SendWeaponAnim( ACT_VM_IDLE ) vm:SetSequence(vm:LookupSequence("midslash2")) //Always do the slashing animation when attacking, makes it so we don't hit it with the butt of our scythe! end end /*------------------------------------------------------
FFS. Did you not learn your lesson from your last ban? Use [CODE] tags for Lua code. EDIT: Looks like he changed it now
Seriously. Use [URL="http://pasteion.com"]http://pastebin.com[/URL] or something.
Sorry, you need to Log In to post a reply to this thread.