public static EntHandle AimingAtEntity() { EntHandle t = 0; unsafe { Call <bool>(GET_ENTITY_PLAYER_IS_FREE_AIMING_AT, CurrentPlayer, new IntPtr(&t)); } return(t); }
public static bool TryGetPlayerTarget(PlayerHandle p, out EntHandle ent) { EntHandle ret = 0; unsafe { try { return(Call <bool>(GET_PLAYER_TARGET_ENTITY, p, new IntPtr(&ret))); } finally { ent = ret; } } }
public static bool TryGetFreeAimEntity(PlayerHandle p, out EntHandle ent) { EntHandle ret = 0; unsafe { try { return(Call <bool>(GET_ENTITY_PLAYER_IS_FREE_AIMING_AT, p, new IntPtr(&ret))); } finally { ent = ret; } } }
public RaycastResult(int result) { bool hit; NativeVector3 hitPos; NativeVector3 normal; int material; int entity; unsafe { Call(_GET_SHAPE_TEST_RESULT_EX, result, new IntPtr(&hit), new IntPtr(&hitPos), new IntPtr(&normal), new IntPtr(&material), new IntPtr(&entity)); } DidHit = hit; HitPosition = hitPos; SurfaceNormal = normal; Material = (Materials)material; Entity = (EntHandle)entity; }
public static Vector3 Position(EntHandle ent) => Position(Matrix(ent)); // Read<Vector3>(Address(ent), 0x90);
public static IntPtr Address(EntHandle ent) => GetEntityAddress((int)ent);
public static BlipHandle GetBlip(EntHandle ent) => Call <BlipHandle>(GET_BLIP_FROM_ENTITY, ent);
public static bool IsPlayerTargeting(PlayerHandle p, EntHandle ent) => Call <bool>(IS_PLAYER_TARGETTING_ENTITY, p, ent);
public bool Contains(EntHandle ent) => Contains((ulong)ent);
/// <summary> /// Blacklist an Entity. /// </summary> public void Add(EntHandle ent, uint duration) => Add((ulong)ent, duration);
public override State OnTick() { if (GamePaused) { return(this); } if (!IsInMission()) { return(Next); } BlipHandle blip; if (PlayerVehicle == VehicleHandle.Invalid) { if (TryGetBlip(BlipHUDColor.Blue, out blip)) { EntHandle ent = GetEntity(blip); switch (GetEntityType(ent)) { case EntityType.Ped: return(new FollowPed((PedHandle)ent, this)); case EntityType.Vehicle: return(new EnterVehicle((VehicleHandle)ent, this)); } } else if (TryGetBlip(BlipHUDColor.Red, out blip)) { EntHandle ent = GetEntity(blip); switch (GetEntityType(ent)) { case EntityType.Ped: return(new FollowPed((PedHandle)ent, this)); case EntityType.Vehicle: return(new EnterVehicle(First(NearbyVehicles()), this)); } } } else // we are in a vehicle { if (TryGetBlip(BlipHUDColor.Yellow, out blip)) { var pos = Position(blip); if (pos != Vector3.Zero) { return(new DriveTo(pos, this) { DrivingFlags = VehicleDrivingFlags.Human }); } } else if (TryGetBlip(BlipHUDColor.Red, out blip)) { EntHandle ent = GetEntity(blip); switch (GetEntityType(ent)) { case EntityType.Ped: var ped = (PedHandle)ent; if (CurrentVehicle(ped) != VehicleHandle.Invalid) { return(new ChaseAndKill() { Target = ped }); } break; case EntityType.Vehicle: if (!IsSeatFree((VehicleHandle)ent, VehicleSeat.Driver)) { return(new ChaseAndKill() { Target = GetPedInSeat((VehicleHandle)ent, VehicleSeat.Driver) }); } break; } } } return(this); }
public static void ApplyForce(EntHandle ent, Vector3 dir, Vector3 rot, ForceType forceType = ForceType.MaxForceRot2, bool isRelative = false) => Call(APPLY_FORCE_TO_ENTITY, ent, forceType, dir, rot, false, isRelative, true, true, false, true);
public static EntHandle AttachedTo(EntHandle ent) => Call <EntHandle>(GET_ENTITY_ATTACHED_TO, ent);
public static void Detach(EntHandle ent) => Call(DETACH_ENTITY, ent, true, true);
public static bool IsAttachedTo(EntHandle a, EntHandle b) => Call <bool>(IS_ENTITY_ATTACHED_TO_ENTITY, a, b);
public static bool IsAttached(EntHandle a) => Call <bool>(IS_ENTITY_ATTACHED, a);
public static void AttachTo(EntHandle a, EntHandle b, BoneIndex bone = BoneIndex.Invalid, Vector3 offset = default, Vector3 rot = default) => Call(ATTACH_ENTITY_TO_ENTITY, a, b, bone, offset, rot, 0, 0, 0, 0, 2, 1);
public static Vector3 Position(VehicleHandle ent) => Position(Matrix(ent)); // Read<Vector3>(Address(ent), 0x90); public static Matrix4x4 Matrix(EntHandle ent) => Read <Matrix4x4>(Address(ent), 0x60);
public static BoneIndex GetBoneIndex(EntHandle ent, string name) => Call <BoneIndex>(GET_ENTITY_BONE_INDEX_BY_NAME, ent, name);
public static bool IsDead(EntHandle ent) => ent == 0 ? false : Exists(ent) && Call <bool>(IS_ENTITY_DEAD, ent);
public static void Delete(EntHandle ent) { IsMissionEntity(ent, false); unsafe { Call(DELETE_ENTITY, new IntPtr(&ent)); } }
public static void NotNeeded(EntHandle ent) { IsMissionEntity(ent, false); unsafe { Call(SET_ENTITY_AS_NO_LONGER_NEEDED, new IntPtr(&ent)); } }
public void Remove(EntHandle handle) => data.Remove((ulong)handle);
public static bool IsFreeAimingAt(PlayerHandle p, EntHandle e) => Call <bool>(IS_PLAYER_FREE_AIMING_AT_ENTITY, p, e);
public static bool IsInvincible(EntHandle ent) => ent == 0 ? false : IsBitSet(Address(ent), 392, 8);
public static void IsCollisionProof(EntHandle ent, bool value) => SetBit(Address(ent), 392, 6, value);
public static EntityType GetEntityType(EntHandle ent) => Call <EntityType>(GET_ENTITY_TYPE, ent);
public static void IsInvincible(EntHandle ent, bool value) => Call(SET_ENTITY_INVINCIBLE, ent, value);
public static bool Exists(EntHandle ent) => ent == 0 ? false : Call <bool>(DOES_ENTITY_EXIST, ent);
public static bool IsCollisionProof(EntHandle ent) => ent == 0 ? false : IsBitSet(Address(ent), 392, 6);