Fixed friendly NPCs being incorrectly targeted by the aimbot/triggerbot. (#3412)

Added friends check to the aimbot/triggerbot.
This commit is contained in:
gir489 2024-07-23 14:13:51 -04:00 committed by GitHub
parent bba720f059
commit 15d92940be
6 changed files with 486 additions and 219 deletions

View File

@ -1,4 +1,3 @@
#include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "pointers.hpp"
#include "gta_util.hpp"

View File

@ -4,6 +4,8 @@
#include "natives.hpp"
#include "util/math.hpp"
#include "util/pools.hpp"
#include "services/friends/friends_service.hpp"
#include "services/player_database/player_database_service.hpp"
namespace big
{
@ -137,14 +139,25 @@ namespace big
continue;
}
if (g.weapons.aimbot.exclude_friends && !ped->m_player_info)
{
auto rockstar_id = ped->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id;
auto is_friend = friends_service::is_friend(rockstar_id);
auto db_player = g_player_database_service->get_player_by_rockstar_id(rockstar_id);
auto is_trusted = db_player && db_player->is_trusted;
if (is_friend || is_trusted)
continue;
}
const auto ped_handle = g_pointers->m_gta.m_ptr_to_handle(ped);
if (g_aimbot_only_on_enemy.is_enabled())
{
bool is_hated_relationship = false;
bool is_in_combat = PED::IS_PED_IN_COMBAT(ped_handle, self::ped);
auto blip_color = HUD::GET_BLIP_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped_handle));
bool is_enemy = PED::GET_PED_CONFIG_FLAG(ped_handle, 38, TRUE) == TRUE || (blip_color == (int)BlipColors::BlipColorEnemy || blip_color == (int)BlipColors::RedMission);
auto blip_color = HUD::GET_BLIP_HUD_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped_handle));
bool is_enemy = ((PED::GET_PED_CONFIG_FLAG(ped_handle, 38, TRUE) == TRUE) || (blip_color == HUD_COLOUR_RED));
switch (PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped_handle, self::ped))
{

View File

@ -2,6 +2,8 @@
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/entity.hpp"
#include "services/friends/friends_service.hpp"
#include "services/player_database/player_database_service.hpp"
namespace big
{
@ -31,12 +33,23 @@ namespace big
if (g.weapons.aimbot.only_on_player && !ped_ptr->m_player_info)
return;
if (g.weapons.aimbot.exclude_friends && !ped_ptr->m_player_info)
{
auto rockstar_id = ped_ptr->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id;
auto is_friend = friends_service::is_friend(rockstar_id);
auto db_player = g_player_database_service->get_player_by_rockstar_id(rockstar_id);
auto is_trusted = db_player && db_player->is_trusted;
if (is_friend || is_trusted)
return;
}
if (g.weapons.aimbot.only_on_enemy)
{
bool is_hated_relationship = false;
bool is_in_combat = PED::IS_PED_IN_COMBAT(ped, self::ped);
auto blip_color = HUD::GET_BLIP_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped));
bool is_enemy = PED::GET_PED_CONFIG_FLAG(ped, 38, TRUE) == TRUE || (blip_color == (int)BlipColors::BlipColorEnemy || blip_color == (int)BlipColors::RedMission);
auto blip_color = HUD::GET_BLIP_HUD_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped));
bool is_enemy = ((PED::GET_PED_CONFIG_FLAG(ped, 38, TRUE) == TRUE) || (blip_color == HUD_COLOUR_RED));
switch (PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped, self::ped))
{

View File

@ -901,6 +901,7 @@ namespace big
bool enable = false;
int64_t only_on_ped_type = -1;
bool only_on_player = false;
bool exclude_friends = false;
bool only_on_enemy = false;
bool has_target = false;
float fov = 60.f;

View File

@ -2140,3 +2140,242 @@ enum PedRelationships : int
Hate,
Indifferent = 255
};
enum HudColors : int //https://docs.fivem.net/docs/game-references/hud-colors/
{
HUD_COLOUR_PURE_WHITE,
HUD_COLOUR_WHITE,
HUD_COLOUR_BLACK,
HUD_COLOUR_GREY,
HUD_COLOUR_GREYLIGHT,
HUD_COLOUR_GREYDARK,
HUD_COLOUR_RED,
HUD_COLOUR_REDLIGHT,
HUD_COLOUR_REDDARK,
HUD_COLOUR_BLUE,
HUD_COLOUR_BLUELIGHT,
HUD_COLOUR_BLUEDARK,
HUD_COLOUR_YELLOW,
HUD_COLOUR_YELLOWLIGHT,
HUD_COLOUR_YELLOWDARK,
HUD_COLOUR_ORANGE,
HUD_COLOUR_ORANGELIGHT,
HUD_COLOUR_ORANGEDARK,
HUD_COLOUR_GREEN,
HUD_COLOUR_GREENLIGHT,
HUD_COLOUR_GREENDARK,
HUD_COLOUR_PURPLE,
HUD_COLOUR_PURPLELIGHT,
HUD_COLOUR_PURPLEDARK,
HUD_COLOUR_PINK,
HUD_COLOUR_RADAR_HEALTH,
HUD_COLOUR_RADAR_ARMOUR,
HUD_COLOUR_RADAR_DAMAGE,
HUD_COLOUR_NET_PLAYER1,
HUD_COLOUR_NET_PLAYER2,
HUD_COLOUR_NET_PLAYER3,
HUD_COLOUR_NET_PLAYER4,
HUD_COLOUR_NET_PLAYER5,
HUD_COLOUR_NET_PLAYER6,
HUD_COLOUR_NET_PLAYER7,
HUD_COLOUR_NET_PLAYER8,
HUD_COLOUR_NET_PLAYER9,
HUD_COLOUR_NET_PLAYER10,
HUD_COLOUR_NET_PLAYER11,
HUD_COLOUR_NET_PLAYER12,
HUD_COLOUR_NET_PLAYER13,
HUD_COLOUR_NET_PLAYER14,
HUD_COLOUR_NET_PLAYER15,
HUD_COLOUR_NET_PLAYER16,
HUD_COLOUR_NET_PLAYER17,
HUD_COLOUR_NET_PLAYER18,
HUD_COLOUR_NET_PLAYER19,
HUD_COLOUR_NET_PLAYER20,
HUD_COLOUR_NET_PLAYER21,
HUD_COLOUR_NET_PLAYER22,
HUD_COLOUR_NET_PLAYER23,
HUD_COLOUR_NET_PLAYER24,
HUD_COLOUR_NET_PLAYER25,
HUD_COLOUR_NET_PLAYER26,
HUD_COLOUR_NET_PLAYER27,
HUD_COLOUR_NET_PLAYER28,
HUD_COLOUR_NET_PLAYER29,
HUD_COLOUR_NET_PLAYER30,
HUD_COLOUR_NET_PLAYER31,
HUD_COLOUR_NET_PLAYER32,
HUD_COLOUR_SIMPLEBLIP_DEFAULT,
HUD_COLOUR_MENU_BLUE,
HUD_COLOUR_MENU_GREY_LIGHT,
HUD_COLOUR_MENU_BLUE_EXTRA_DARK,
HUD_COLOUR_MENU_YELLOW,
HUD_COLOUR_MENU_YELLOW_DARK,
HUD_COLOUR_MENU_GREEN,
HUD_COLOUR_MENU_GREY,
HUD_COLOUR_MENU_GREY_DARK,
HUD_COLOUR_MENU_HIGHLIGHT,
HUD_COLOUR_MENU_STANDARD,
HUD_COLOUR_MENU_DIMMED,
HUD_COLOUR_MENU_EXTRA_DIMMED,
HUD_COLOUR_BRIEF_TITLE,
HUD_COLOUR_MID_GREY_MP,
HUD_COLOUR_NET_PLAYER1_DARK,
HUD_COLOUR_NET_PLAYER2_DARK,
HUD_COLOUR_NET_PLAYER3_DARK,
HUD_COLOUR_NET_PLAYER4_DARK,
HUD_COLOUR_NET_PLAYER5_DARK,
HUD_COLOUR_NET_PLAYER6_DARK,
HUD_COLOUR_NET_PLAYER7_DARK,
HUD_COLOUR_NET_PLAYER8_DARK,
HUD_COLOUR_NET_PLAYER9_DARK,
HUD_COLOUR_NET_PLAYER10_DARK,
HUD_COLOUR_NET_PLAYER11_DARK,
HUD_COLOUR_NET_PLAYER12_DARK,
HUD_COLOUR_NET_PLAYER13_DARK,
HUD_COLOUR_NET_PLAYER14_DARK,
HUD_COLOUR_NET_PLAYER15_DARK,
HUD_COLOUR_NET_PLAYER16_DARK,
HUD_COLOUR_NET_PLAYER17_DARK,
HUD_COLOUR_NET_PLAYER18_DARK,
HUD_COLOUR_NET_PLAYER19_DARK,
HUD_COLOUR_NET_PLAYER20_DARK,
HUD_COLOUR_NET_PLAYER21_DARK,
HUD_COLOUR_NET_PLAYER22_DARK,
HUD_COLOUR_NET_PLAYER23_DARK,
HUD_COLOUR_NET_PLAYER24_DARK,
HUD_COLOUR_NET_PLAYER25_DARK,
HUD_COLOUR_NET_PLAYER26_DARK,
HUD_COLOUR_NET_PLAYER27_DARK,
HUD_COLOUR_NET_PLAYER28_DARK,
HUD_COLOUR_NET_PLAYER29_DARK,
HUD_COLOUR_NET_PLAYER30_DARK,
HUD_COLOUR_NET_PLAYER31_DARK,
HUD_COLOUR_NET_PLAYER32_DARK,
HUD_COLOUR_BRONZE,
HUD_COLOUR_SILVER,
HUD_COLOUR_GOLD,
HUD_COLOUR_PLATINUM,
HUD_COLOUR_GANG1,
HUD_COLOUR_GANG2,
HUD_COLOUR_GANG3,
HUD_COLOUR_GANG4,
HUD_COLOUR_SAME_CREW,
HUD_COLOUR_FREEMODE,
HUD_COLOUR_PAUSE_BG,
HUD_COLOUR_FRIENDLY,
HUD_COLOUR_ENEMY,
HUD_COLOUR_LOCATION,
HUD_COLOUR_PICKUP,
HUD_COLOUR_PAUSE_SINGLEPLAYER,
HUD_COLOUR_FREEMODE_DARK,
HUD_COLOUR_INACTIVE_MISSION,
HUD_COLOUR_DAMAGE,
HUD_COLOUR_PINKLIGHT,
HUD_COLOUR_PM_MITEM_HIGHLIGHT,
HUD_COLOUR_SCRIPT_VARIABLE,
HUD_COLOUR_YOGA,
HUD_COLOUR_TENNIS,
HUD_COLOUR_GOLF,
HUD_COLOUR_SHOOTING_RANGE,
HUD_COLOUR_FLIGHT_SCHOOL,
HUD_COLOUR_NORTH_BLUE,
HUD_COLOUR_SOCIAL_CLUB,
HUD_COLOUR_PLATFORM_BLUE,
HUD_COLOUR_PLATFORM_GREEN,
HUD_COLOUR_PLATFORM_GREY,
HUD_COLOUR_FACEBOOK_BLUE,
HUD_COLOUR_INGAME_BG,
HUD_COLOUR_DARTS,
HUD_COLOUR_WAYPOINT,
HUD_COLOUR_MICHAEL,
HUD_COLOUR_FRANKLIN,
HUD_COLOUR_TREVOR,
HUD_COLOUR_GOLF_P1,
HUD_COLOUR_GOLF_P2,
HUD_COLOUR_GOLF_P3,
HUD_COLOUR_GOLF_P4,
HUD_COLOUR_WAYPOINTLIGHT,
HUD_COLOUR_WAYPOINTDARK,
HUD_COLOUR_PANEL_LIGHT,
HUD_COLOUR_MICHAEL_DARK,
HUD_COLOUR_FRANKLIN_DARK,
HUD_COLOUR_TREVOR_DARK,
HUD_COLOUR_OBJECTIVE_ROUTE,
HUD_COLOUR_PAUSEMAP_TINT,
HUD_COLOUR_PAUSE_DESELECT,
HUD_COLOUR_PM_WEAPONS_PURCHASABLE,
HUD_COLOUR_PM_WEAPONS_LOCKED,
HUD_COLOUR_END_SCREEN_BG,
HUD_COLOUR_CHOP,
HUD_COLOUR_PAUSEMAP_TINT_HALF,
HUD_COLOUR_NORTH_BLUE_OFFICIAL,
HUD_COLOUR_SCRIPT_VARIABLE_2,
HUD_COLOUR_H,
HUD_COLOUR_HDARK,
HUD_COLOUR_T,
HUD_COLOUR_TDARK,
HUD_COLOUR_HSHARD,
HUD_COLOUR_CONTROLLER_MICHAEL,
HUD_COLOUR_CONTROLLER_FRANKLIN,
HUD_COLOUR_CONTROLLER_TREVOR,
HUD_COLOUR_CONTROLLER_CHOP,
HUD_COLOUR_VIDEO_EDITOR_VIDEO,
HUD_COLOUR_VIDEO_EDITOR_AUDIO,
HUD_COLOUR_VIDEO_EDITOR_TEXT,
HUD_COLOUR_HB_BLUE,
HUD_COLOUR_HB_YELLOW,
HUD_COLOUR_VIDEO_EDITOR_SCORE,
HUD_COLOUR_VIDEO_EDITOR_AUDIO_FADEOUT,
HUD_COLOUR_VIDEO_EDITOR_TEXT_FADEOUT,
HUD_COLOUR_VIDEO_EDITOR_SCORE_FADEOUT,
HUD_COLOUR_HEIST_BACKGROUND,
HUD_COLOUR_VIDEO_EDITOR_AMBIENT,
HUD_COLOUR_VIDEO_EDITOR_AMBIENT_FADEOUT,
HUD_COLOUR_VIDEO_EDITOR_AMBIENT_DARK,
HUD_COLOUR_VIDEO_EDITOR_AMBIENT_LIGHT,
HUD_COLOUR_VIDEO_EDITOR_AMBIENT_MID,
HUD_COLOUR_LOW_FLOW,
HUD_COLOUR_LOW_FLOW_DARK,
HUD_COLOUR_G1,
HUD_COLOUR_G2,
HUD_COLOUR_G3,
HUD_COLOUR_G4,
HUD_COLOUR_G5,
HUD_COLOUR_G6,
HUD_COLOUR_G7,
HUD_COLOUR_G8,
HUD_COLOUR_G9,
HUD_COLOUR_G10,
HUD_COLOUR_G11,
HUD_COLOUR_G12,
HUD_COLOUR_G13,
HUD_COLOUR_G14,
HUD_COLOUR_G15,
HUD_COLOUR_ADVERSARY,
HUD_COLOUR_DEGEN_RED,
HUD_COLOUR_DEGEN_YELLOW,
HUD_COLOUR_DEGEN_GREEN,
HUD_COLOUR_DEGEN_CYAN,
HUD_COLOUR_DEGEN_BLUE,
HUD_COLOUR_DEGEN_MAGENTA,
HUD_COLOUR_STUNT_1,
HUD_COLOUR_STUNT_2,
HUD_COLOUR_SPECIAL_RACE_SERIES,
HUD_COLOUR_SPECIAL_RACE_SERIES_DARK,
HUD_COLOUR_CS,
HUD_COLOUR_CS_DARK,
HUD_COLOUR_TECH_GREEN,
HUD_COLOUR_TECH_GREEN_DARK,
HUD_COLOUR_TECH_RED,
HUD_COLOUR_TECH_GREEN_VERY_DARK,
HUD_COLOUR_PLACEHOLDER_01,
HUD_COLOUR_PLACEHOLDER_02,
HUD_COLOUR_PLACEHOLDER_03,
HUD_COLOUR_PLACEHOLDER_04,
HUD_COLOUR_PLACEHOLDER_05,
HUD_COLOUR_PLACEHOLDER_06,
HUD_COLOUR_PLACEHOLDER_07,
HUD_COLOUR_PLACEHOLDER_08,
HUD_COLOUR_PLACEHOLDER_09,
HUD_COLOUR_PLACEHOLDER_10,
HUD_COLOUR_JUNK_ENERGY
};

View File

@ -190,6 +190,8 @@ namespace big
{
components::command_checkbox<"aimonlyatplayer">();
ImGui::SameLine();
ImGui::Checkbox("TRUST_FRIENDS"_T.data(), &g.weapons.aimbot.exclude_friends);
ImGui::SameLine();
components::command_checkbox<"aimonlyatenemy">();
ImGui::CheckboxFlags("PLAYERS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_NETWORK_PLAYER);