Created
July 14, 2018 02:26
-
-
Save ilya-pirogov/961cc43a8bf69dea2c6ca9cebdbdaff4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using CitizenFX.Core; | |
using CitizenFX.Core.Native; | |
using CitizenFX.Core.UI; | |
using JetBrains.Annotations; | |
namespace MiscThingsClient | |
{ | |
public class Main : BaseScript | |
{ | |
public Main() | |
{ | |
Tick += OnDumpHashTick; | |
} | |
private async Task OnDumpHashTick() | |
{ | |
if (Game.IsControlPressed(0, Control.VehicleFlySelectTargetRight) || Game.IsControlJustReleased(0, Control.VehicleFlySelectTargetRight)) | |
{ | |
var dir = GameMath.RotationToDirection(GameplayCamera.Rotation); | |
var res = World.RaycastCapsule(GameplayCamera.Position, dir, 150f, 0.1f, IntersectOptions.Objects, Game.PlayerPed); | |
if (res.DitHit && res.DitHitEntity && res.HitEntity.Handle != Game.PlayerPed.Handle) | |
{ | |
var target = res.HitEntity as Prop; | |
if (target == null) | |
{ | |
Debug.WriteLine("This is not a prop"); | |
return; | |
} | |
World.DrawMarker(MarkerType.DebugSphere, target.Position, Vector3.Zero, Vector3.Zero, | |
new Vector3(1f, 1f, 1f), Color.FromArgb(0, 255, 0)); | |
if (Game.IsControlJustReleased(0, Control.VehicleFlySelectTargetRight)) | |
{ | |
var msg = $"Pos: {target.Position}; Hash: {target.Model}"; | |
Debug.WriteLine(msg); | |
Screen.ShowNotification(msg); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment