From a5234c16a344fa3e75ca9eb60f2e7118fb521f01 Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Wed, 20 Sep 2023 10:28:08 -0400 Subject: [PATCH] Replaced original arthurs game detection code. Fixed aimbot shooting teamates and chams. --- src/util.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/util.c b/src/util.c index 835918f..26ecef7 100644 --- a/src/util.c +++ b/src/util.c @@ -9,6 +9,7 @@ #include "include/util.h" #include "include/sdk.h" #include "include/globals.h" +#include "include/game_detection.h" cl_entity_t* get_player(int ent_idx) { if (ent_idx < 0 || ent_idx > 32) @@ -35,29 +36,23 @@ bool is_friend(cl_entity_t* ent) { if (!ent) return false; - /* Check the current game because this method only works for some games */ - switch (this_game_id) { - case TF: { + GameType game = get_current_game(); + + switch (game) { + case GAME_TFC: { extra_player_info_t* info = (extra_player_info_t*)player_extra_info; - - return info[ent->index].teamnumber == - info[localplayer->index].teamnumber; + return info[ent->index].teamnumber == info[localplayer->index].teamnumber; } - case CS: { - extra_player_info_cs_t* info = - (extra_player_info_cs_t*)player_extra_info; - - return info[ent->index].teamnumber == - info[localplayer->index].teamnumber; + case GAME_CS16: { + extra_player_info_cs_t* info = (extra_player_info_cs_t*)player_extra_info; + return info[ent->index].teamnumber == info[localplayer->index].teamnumber; } - case DOD: { - extra_player_info_dod_t* info = - (extra_player_info_dod_t*)player_extra_info; - - return info[ent->index].teamnumber == - info[localplayer->index].teamnumber; + case GAME_DAY_OF_DEFEAT: { + extra_player_info_dod_t* info = (extra_player_info_dod_t*)player_extra_info; + return info[ent->index].teamnumber == info[localplayer->index].teamnumber; } - case HL: + case GAME_HALFLIFE: + case GAME_DMC: default: return false; }