Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private animSetCombat As AnimationSet = New AnimationSet("melee_ped_unarmed")
- Private animSetCombat2 As AnimationSet = New AnimationSet("melee_gang_unarmed")
- Private animSetCombatRun As AnimationSet = New AnimationSet("move_player")
- Private animSetCombatNormal As AnimationSet = New AnimationSet("melee_unarmed_base")
- Private sAnimCombat As String = "hook_r_long"
- Private sAnimCombat2 As String = "low_kick_nuts"
- Private Sub meleeAttackTick()
- If bPlayerNotInCombat AndAlso (Player.Character.Weapons.Current = Weapon.Unarmed) AndAlso Player.Character.isInMeleeCombat Then
- If Player.Character.Animation.isPlaying(animSetCombatNormal, "partial_punch_r") OrElse Player.Character.Animation.isPlaying(animSetCombatNormal, "jab") Then
- Dim tmpPeds As Ped() = World.GetPeds(Player.Character.Position + Player.Character.Direction * 2, 4)
- Dim tmpTargetPos As Vector3 = Player.Character.Position + Player.Character.Direction * 4
- Dim tmpMinDist As Double = 1000
- Dim tmpTarget As Ped = Nothing
- Dim bTargetOnGround As Boolean = False
- For Each p As Ped In tmpPeds
- If Exists(p) AndAlso (p <> Player.Character) AndAlso Not Exists(p.CurrentVehicle) AndAlso (p.Health > 0) Then
- If p.Position.DistanceTo(tmpTargetPos) < tmpMinDist Then
- tmpMinDist = p.Position.DistanceTo(tmpTargetPos)
- tmpTarget = p
- End If
- End If
- Next
- If Exists(tmpTarget) Then
- tmpTargetPos = tmpTarget.Position
- Player.Character.Heading = Helper.DirectionToHeading(Vector3.Normalize(tmpTarget.Position - Player.Character.Position))
- tmpTarget.Velocity *= 0.3
- bTargetOnGround = (tmpTarget.isRagdoll OrElse tmpTarget.isGettingUp)
- End If
- Dim tmpTimeOut As Date = Now
- While (Player.Character.Position.DistanceTo(tmpTargetPos) > 1) AndAlso Exists(tmpTarget)
- shouldDrawScreenFillers()
- myNatives.securePlayAnim(Player.Character, animSetCombatRun, "sprint", 8, AnimationFlags.Unknown01)
- myNatives.setAnimSpeed(Player.Character, animSetCombatRun.Name, "sprint", 1.2)
- 'Player.Character.ApplyForce(tmpTargetPos - Player.Character.Position)
- While Player.Character.Animation.isPlaying(animSetCombatRun, "sprint") AndAlso _
- (Player.Character.Animation.GetCurrentAnimationTime(animSetCombatRun, "sprint") < 0.8) AndAlso _
- Player.Character.Position.DistanceTo(tmpTargetPos) > 1
- Wait(5)
- If Exists(tmpTarget) Then
- tmpTargetPos = tmpTarget.Position
- If (Player.Character.Position.DistanceTo(tmpTarget.Position) > 1) OrElse Not tmpTarget.isRagdoll Then
- If Player.Character.Position.DistanceTo(tmpTarget.Position) > 1.5 Then _
- Player.Character.Heading = Helper.DirectionToHeading(Vector3.Normalize(tmpTarget.Position + tmpTarget.Velocity * 0.25 - Player.Character.Position))
- 'Player.Character.ApplyForce(Vector3.Normalize(tmpTargetPos - Player.Character.Position))
- End If
- End If
- shouldDrawScreenFillers()
- If Player.Character.Health <= 0 Then Exit While
- End While
- If (Player.Character.Health <= 0) OrElse Now.Subtract(tmpTimeOut).TotalMilliseconds > 2000 Then Exit While
- shouldDrawScreenFillers()
- Wait(5)
- End While
- If Exists(tmpTarget) Then tmpTarget.Velocity = Vector3.Zero
- Player.Character.Velocity = Vector3.Zero
- If Now.Subtract(tmpTimeOut).TotalMilliseconds > 2000 Then Exit Sub
- If Player.Character.Health > 0 Then
- If Not Exists(tmpTarget) Then tmpTargetPos = Player.Character.Position + Player.Character.Direction * 4
- Player.Character.ApplyForce((tmpTargetPos - Player.Character.Position))
- Dim tmpAnimSet As AnimationSet = animSetCombat
- Dim tmpAnim As String = sAnimCombat
- If bTargetOnGround Then
- tmpAnimSet = animSetCombat2
- tmpAnim = sAnimCombat2
- End If
- myNatives.securePlayAnim(Player.Character, tmpAnimSet, tmpAnim, 8, AnimationFlags.Unknown01)
- 'myNatives.setAnimPercent(Player.Character, tmpAnimSet.Name, tmpAnim, 0.2)
- If Not bTargetOnGround Then myNatives.setAnimSpeed(Player.Character, tmpAnimSet.Name, tmpAnim, 1.5)
- If Exists(tmpTarget) Then
- tmpTarget.Velocity *= 0.3
- If Not tmpTarget.isRagdoll Then tmpTarget.PreventRagdoll = True
- End If
- Dim tmpFirstHitDone As Boolean = False
- While Player.Character.Animation.isPlaying(tmpAnimSet, tmpAnim) AndAlso _
- (Player.Character.Animation.GetCurrentAnimationTime(tmpAnimSet, tmpAnim) < 0.5)
- Wait(5)
- shouldDrawScreenFillers()
- If (Player.Character.Animation.GetCurrentAnimationTime(tmpAnimSet, tmpAnim) > 0.4) Then
- myNatives.setAnimSpeed(Player.Character, tmpAnimSet.Name, tmpAnim, 1.5)
- End If
- If Exists(tmpTarget) Then
- tmpTargetPos = tmpTarget.Position
- If (Player.Character.Position.DistanceTo(tmpTarget.Position) > 1) OrElse Not tmpTarget.isRagdoll Then
- If Player.Character.Position.DistanceTo(tmpTarget.Position) > 2 Then _
- Player.Character.Heading = Helper.DirectionToHeading(Vector3.Normalize(tmpTarget.Position - Player.Character.Position))
- Player.Character.ApplyForce(tmpTargetPos - Player.Character.Position)
- End If
- End If
- If (Player.Character.Animation.GetCurrentAnimationTime(tmpAnimSet, tmpAnim) > 0.3) Then
- Player.Character.Heading = Helper.DirectionToHeading(Vector3.Normalize(tmpTargetPos - Player.Character.Position))
- If Not tmpFirstHitDone Then
- For Each p As Ped In World.GetPeds(Player.Character.Position + Player.Character.Direction, 1.2)
- If Exists(p) AndAlso (p <> Player.Character) AndAlso Not Exists(p.CurrentVehicle) _
- AndAlso (p.Health > 0) Then
- If ((tmpAnim <> sAnimCombat2) AndAlso (p.Position.DistanceTo(Player.Character.Position) <= 0.75)) OrElse
- (tmpAnim = sAnimCombat2) Then
- Native.Function.Call("damage_char", p, TRandom.Next(50, 110), 0)
- waitEx(100)
- p.PreventRagdoll = False
- 'p.ForceRagdoll(7000, False)
- p.Euphoria.BeingShot().Start(2000)
- p.ApplyForce(Player.Character.Direction * 3, Vector3.WorldNorth * 0.5)
- myNatives.playSoundFromPed("anim_melee_punch_to_face", Player.Character)
- tmpFirstHitDone = True
- increaseAbility(0.5)
- For Each p2 As Ped In World.GetPeds(Player.Character.Position, 10)
- If Exists(p2) AndAlso (p2 <> Player.Character) AndAlso Not p2.isRequiredForMission Then
- If (p2.PedType <> PedType.Cop) Then
- If (p2.Weapons.Glock.Ammo > 0) OrElse (p2.Weapons.DesertEagle.Ammo > 0) OrElse (p2.Weapons.BasicShotgun.Ammo > 0) Then
- p2.Task.FightAgainst(Player.Character)
- Else
- p2.Task.FleeFromChar(Player.Character)
- End If
- Else
- If myNatives.getWantedLevel = 0 Then
- Native.Function.Call("ALTER_WANTED_LEVEL", Player, 1)
- Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player)
- End If
- End If
- End If
- Next
- Exit For
- End If
- End If
- Next
- End If
- End If
- If Player.Character.Health <= 0 Then Exit While
- End While
- If Exists(tmpTarget) Then
- tmpTarget.PreventRagdoll = False
- End If
- 'If tmpAnim <> sAnimCombat2 Then
- myNatives.setAnimSpeed(Player.Character, tmpAnimSet.Name, tmpAnim, 0.3)
- waitEx(200)
- myNatives.setAnimSpeed(Player.Character, tmpAnimSet.Name, tmpAnim, 1)
- 'End If
- End If
- End If
- End If
- bPlayerNotInCombat = Not Player.Character.isInMeleeCombat
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement