Skip to content

Instantly share code, notes, and snippets.

@ilya-pirogov
Created July 14, 2018 02:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilya-pirogov/961cc43a8bf69dea2c6ca9cebdbdaff4 to your computer and use it in GitHub Desktop.
Save ilya-pirogov/961cc43a8bf69dea2c6ca9cebdbdaff4 to your computer and use it in GitHub Desktop.
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