Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub laserBeam(targetPos As Vector3)
- Dim pos As Vector3
- If laserBeamType = 0 Then
- If THelper.Exists(armor.repulsorObject) Then
- pos = armor.repulsorObject.Position
- Else
- If laserBeamTwoHanded Then
- pos = Native.Function.Call(Of Vector3)(Native.Hash.GET_PED_BONE_COORDS, user, Bone.SKEL_R_Hand, 0.1 + armor.hand_R_Offset.X, 0.1 + armor.hand_R_Offset.Y, -0.1 + armor.hand_R_Offset.Z)
- Else
- pos = Native.Function.Call(Of Vector3)(Native.Hash.GET_PED_BONE_COORDS, user, Bone.SKEL_R_Hand, 0.1 + armor.hand_R_Offset.X, 0.02 + armor.hand_R_Offset.Y, -0.1 + armor.hand_R_Offset.Z)
- End If
- End If
- Else
- If firstPerson AndAlso bFlying Then
- pos = Native.Function.Call(Of Vector3)(Native.Hash.GET_PED_BONE_COORDS, user, Bone.SKEL_Spine2, -0.15, 0, 0)
- Else
- pos = Native.Function.Call(Of Vector3)(Native.Hash.GET_PED_BONE_COORDS, user, Bone.SKEL_Spine2, 0.05, 0, 0)
- End If
- End If
- Dim pos2 As Vector3 = targetPos
- Dim sizeCoef As Double = 0.17
- Dim sizeCoefChange As Double = 0.00015
- Dim tmpPos As Vector3 = pos
- Dim tmpCamDir As Vector3 = Vector3.Normalize(pos2 - pos) ' THelper.RotationToDirection(GameplayCamera.Rotation)
- If laserBeamType = 1 Then
- tmpPos += tmpCamDir * Math.Max(0.2, Math.Min(1, speed.Length))
- End If
- If laserBeamType = 0 Then
- sizeCoef = 0.1
- sizeCoefChange = 0.0001
- End If
- If bLaserBeamTriggerExtraFX Then
- bLaserBeamTriggerExtraFX = False
- 'If (speed.Length < 5) Then
- If laserBeamType = 1 Then
- THelper.ptfx_triggerOnPedBone(user, Bone.SKEL_Spine3, "scr_trev1_trailer_boosh", "scr_trevor1", New Vector3(0.25, 0.3, 0), New Vector3(190, 0, 0), 0.55)
- ElseIf laserBeamType = 0 Then
- THelper.ptfx_triggerOnPedBone(user, Bone.SKEL_R_Hand, "scr_trev1_trailer_boosh", "scr_trevor1", New Vector3(0.2, 0, 0), New Vector3(95, 0, 0), 0.35)
- End If
- 'End If
- End If
- Dim tmpTargetEnt As Entity = Nothing
- Dim tmpTargetVec As Vector3
- If timeCounter Mod 100 = 0 Then
- For Each e As Entity In closerTargets
- Try
- If THelper.Exists(e) Then
- Native.Function.Call(Native.Hash.SET_ENTITY_CAN_BE_DAMAGED, e, True)
- If (Native.Function.Call(Of Boolean)(Native.Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, e, user)) Then
- Native.Function.Call(Native.Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, e)
- If (Native.Function.Call(Of Boolean)(Native.Hash.IS_ENTITY_VISIBLE, e)) Then
- 'If e.Model.IsVehicle AndAlso (e <> user.CurrentVehicle) Then
- tmpTargetEnt = e
- If Not THelper.victimExists(victims, e) Then
- Dim tmpV As THelper.TVictim = New THelper.TVictim(e)
- If THelper.isPed(e) Then
- THelper.setPedToRagdoll(e, 2000, 2000)
- THelper.damagePed(e, 25 * laserBeamSizeCoef, 1)
- End If
- tmpV.flightDir = tmpCamDir
- tmpV.bPlayVehCrashSound = False
- tmpV.desiredSpeed = laserBeamSizeCoef * 4
- victims.Add(tmpV)
- End If
- Exit For
- 'End If
- End If
- End If
- End If
- Catch
- End Try
- Next
- If Not THelper.Exists(tmpTargetEnt) Then
- Dim tmpEntToIgnore As Entity = user
- If bFlying Then
- tmpEntToIgnore = flightEntity
- End If
- tmpTargetEnt = THelper.getTargetedDistEntity(pos + tmpCamDir, pos2, 200, tmpEntToIgnore, 0.25)
- End If
- If THelper.Exists(tmpTargetEnt) Then
- If Not THelper.victimExists(victims, tmpTargetEnt) Then
- Dim tmpV As THelper.TVictim = New THelper.TVictim(tmpTargetEnt)
- If THelper.isPed(tmpTargetEnt) Then
- THelper.setPedToRagdoll(tmpTargetEnt, 2000, 2000)
- THelper.damagePed(tmpTargetEnt, 25 * laserBeamSizeCoef, 1)
- End If
- tmpV.flightDir = tmpCamDir
- tmpV.bPlayVehCrashSound = False
- tmpV.desiredSpeed = laserBeamSizeCoef * 4
- victims.Add(tmpV)
- End If
- End If
- End If
- Dim tmpShotPos As Vector3 = pos + tmpCamDir
- Dim tmpShotPosEnd As Vector3 = pos + tmpCamDir * 50
- If timeCounter Mod 50 = 0 Then
- Native.Function.Call(Native.Hash.SHOOT_SINGLE_BULLET_BETWEEN_COORDS, tmpShotPos.X, tmpShotPos.Y, tmpShotPos.Z, tmpShotPosEnd.X, tmpShotPosEnd.Y, tmpShotPosEnd.Z, _
- 1, 1, fakeShootHash, user, 1, 1, 100.0)
- End If
- 'If timeCounter Mod 150 = 0 Then
- 'Native.Function.Call(Native.Hash.SHOOT_SINGLE_BULLET_BETWEEN_COORDS, tmpShotPos.X, tmpShotPos.Y, tmpShotPos.Z, tmpShotPosEnd.X, tmpShotPosEnd.Y, tmpShotPosEnd.Z, _
- '1, 1, fakeShootHash, user, 1, 1, 100.0)
- 'End If
- If THelper.Exists(tmpTargetEnt) Then
- tmpTargetVec = tmpTargetEnt.Position
- If Not THelper.isVehicle(tmpTargetEnt) Then
- tmpTargetEnt.ApplyForce(tmpCamDir * THelper.getFPSCoef, Vector3.WorldNorth + Vector3.WorldEast)
- Else
- Try
- Dim tmpVeh As Vehicle = DirectCast(tmpTargetEnt, Vehicle)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.BackLeftDoor)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.BackRightDoor)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.FrontLeftDoor)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.FrontRightDoor)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.Hood)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.Trunk)
- Native.Function.Call(Native.Hash.SET_VEHICLE_DOOR_LATCHED, tmpVeh, VehicleDoor.Trunk2)
- tmpVeh.SmashWindow(VehicleWindow.BackLeftWindow)
- tmpVeh.SmashWindow(VehicleWindow.BackRightWindow)
- tmpVeh.SmashWindow(VehicleWindow.FrontLeftWindow)
- tmpVeh.SmashWindow(VehicleWindow.FrontRightWindow)
- Catch
- End Try
- End If
- If (laserBeamType = 1) Then
- THelper.ptfx_triggerOnCoord(tmpTargetVec, "scr_agency3b_linger_smoke", "scr_agencyheistb")
- If Not tmpTargetEnt.IsOnFire Then _
- Native.Function.Call(Native.Hash.START_ENTITY_FIRE, tmpTargetEnt)
- End If
- THelper.ptfx_triggerOnCoord(tmpTargetVec, "scr_fam1_blood_headshot", "scr_family1")
- Else
- tmpTargetVec = THelper.getTargetedCoord(pos + tmpCamDir, pos2)
- End If
- Dim tmpExpCoef As Double = 1
- Dim tmpLightCoef As Double = 1
- If laserBeamType = 1 Then
- tmpExpCoef = 1.5
- tmpLightCoef = 1.3
- End If
- tmpLightCoef *= laserBeamSizeCoef
- Dim tmpColor As Color = Color.FromArgb(10 + (5 * TRandom.NextDouble), 255, 25 + (50 * TRandom.NextDouble), 25 + (25 * TRandom.NextDouble)) 'Color.FromArgb(20, 255, 100, 75)
- If laserBeamType = 1 Then
- tmpColor = Color.FromArgb(10 + (5 * TRandom.NextDouble), 125 + (25 * TRandom.NextDouble), 200 + (25 * TRandom.NextDouble), 255) 'Color.FromArgb(20, 75, 200, 255)
- End If
- If tmpTargetVec <> Vector3.Zero Then
- If (laserBeamType = 1) OrElse (laserBeamSizeCoef > 1.5) OrElse THelper.Exists(tmpTargetEnt) AndAlso (THelper.isObject(tmpTargetEnt)) Then
- If Now.Subtract(timerSinceLastAddedExplosion).TotalMilliseconds > 100 * THelper.getTimeCoef Then
- timerSinceLastAddedExplosion = Now
- If THelper.Exists(tmpTargetEnt) Then
- Native.Function.Call(Native.Hash.ADD_OWNED_EXPLOSION, user, tmpTargetVec.X, tmpTargetVec.Y, tmpTargetVec.Z + 0.1, ExplosionType.Bike, 0.1 * tmpExpCoef, 0, 1, 0)
- Else
- Native.Function.Call(Native.Hash.ADD_OWNED_EXPLOSION, user, tmpTargetVec.X, tmpTargetVec.Y, tmpTargetVec.Z + 0.1, ExplosionType.Bike, 0.1 * tmpExpCoef, 0, 1, 0)
- End If
- timerIgnoreExplosions = Now
- End If
- End If
- Dim tmpDecalSize1 As Double = 0.5
- Dim tmpDecalSize2 As Double = 0.6
- If laserBeamType = 1 Then
- tmpDecalSize1 += 0.2
- tmpDecalSize1 += 0.2
- End If
- If timeCounter Mod 50 = 0 Then
- THelper.addDecal(tmpTargetVec, THelper.TDecalTypes.burn2, tmpDecalSize1 + 0.2 * TRandom.NextDouble, tmpDecalSize1 + 0.2 * TRandom.NextDouble, 20, 0.5)
- THelper.addDecal(tmpTargetVec, THelper.TDecalTypes.bang_concrete_bang, tmpDecalSize2 + 0.2 * TRandom.NextDouble, tmpDecalSize2 + 0.2 * TRandom.NextDouble, 20, 0.5, 0, 0, 0)
- End If
- Dim tmpLightPos As Vector3 = tmpTargetVec - tmpCamDir * 0.25
- If THelper.Exists(tmpTargetEnt) Then
- Native.Function.Call(Native.Hash.DRAW_LIGHT_WITH_RANGE, tmpLightPos.X, tmpLightPos.Y, tmpLightPos.Z, tmpColor.R, tmpColor.G, tmpColor.B, 0.35 * tmpLightCoef, 500.0 * tmpLightCoef)
- Native.Function.Call(Native.Hash.DRAW_LIGHT_WITH_RANGE, tmpLightPos.X, tmpLightPos.Y, tmpLightPos.Z, tmpColor.R, tmpColor.G, tmpColor.B, 1.0 * tmpLightCoef, 100.0 * tmpLightCoef)
- Else
- Native.Function.Call(Native.Hash.DRAW_LIGHT_WITH_RANGE, tmpLightPos.X, tmpLightPos.Y, tmpLightPos.Z, tmpColor.R, tmpColor.G, tmpColor.B, 0.35 * tmpLightCoef, 10.0 * tmpLightCoef)
- Native.Function.Call(Native.Hash.DRAW_LIGHT_WITH_RANGE, tmpLightPos.X, tmpLightPos.Y, tmpLightPos.Z, tmpColor.R, tmpColor.G, tmpColor.B, 1.0 * tmpLightCoef, 1.0 * tmpLightCoef)
- End If
- End If
- Dim tmpStepSize As Double = 0.01
- Dim tmpAlphaCoef As Double = 0.5
- Dim tmpStepInc As Double = 0.01
- If firstPerson Then
- tmpStepSize = 0.005
- tmpStepInc = 0.005
- End If
- Dim tmpDetailed As Boolean = bPlayer AndAlso getbLookingBehind(Me)
- If tmpDetailed Then
- tmpStepSize = 0.0035
- tmpStepInc = 0.0035
- If laserBeamType = 1 Then
- tmpPos -= tmpCamDir * Math.Max(0.1, Math.Min(0.9, speed.Length))
- sizeCoef *= 0.8
- End If
- End If
- For c As Integer = 0 To 100
- Dim tmpSizeCoef As Double = (sizeCoef + (0.03 * TRandom.NextDouble)) * laserBeamSizeCoef
- Dim tmpSizeCoefW As Double = (sizeCoef * 0.5 + (0.03 * TRandom.NextDouble)) * laserBeamSizeCoef
- Dim tmpAlphaF As Integer = (Math.Min(255, tmpColor.A + 50) * tmpAlphaCoef)
- Dim tmpAlphaW As Integer = (200 * tmpAlphaCoef)
- If tmpDetailed OrElse (c Mod 3 = 0) Then
- Native.Function.Call(Native.Hash.DRAW_MARKER, MarkerType.DebugSphere, tmpPos.X, tmpPos.Y, tmpPos.Z, 0, 0, 0, 0, 0, 0, tmpSizeCoef, tmpSizeCoef, tmpSizeCoef, _
- tmpColor.R, tmpColor.G, tmpColor.B, tmpAlphaF, 0, 0, 2, 0, 0, 0, 0)
- End If
- Native.Function.Call(Native.Hash.DRAW_MARKER, MarkerType.DebugSphere, tmpPos.X, tmpPos.Y, tmpPos.Z, 0, 0, 0, 0, 0, 0, tmpSizeCoefW, tmpSizeCoefW, tmpSizeCoefW, _
- 255, 255, 255, tmpAlphaW, 0, 0, 2, 0, 0, 0, 0)
- If (c > 1) AndAlso (c Mod 5 = 0) Then
- Native.Function.Call(Native.Hash.DRAW_LIGHT_WITH_RANGE, tmpPos.X, tmpPos.Y, tmpPos.Z, tmpColor.R, tmpColor.G, tmpColor.B, 1.0 * tmpLightCoef, 10.0 * tmpLightCoef)
- Native.Function.Call(Native.Hash.DRAW_LIGHT_WITH_RANGE, tmpPos.X, tmpPos.Y, tmpPos.Z, tmpColor.R, tmpColor.G, tmpColor.B, 2.5 * tmpLightCoef, 2.0 * tmpLightCoef)
- If tmpAlphaCoef > 0.01 Then
- tmpAlphaCoef -= 0.01
- End If
- End If
- sizeCoef -= sizeCoefChange
- tmpPos += tmpCamDir * tmpStepSize
- incMoveEase(tmpStepSize, tmpStepInc, 0.3)
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement