Replaced original arthurs game detection code. Fixed aimbot shooting teamates and chams.

This commit is contained in:
Wizzard 2023-09-20 10:28:08 -04:00
parent f38678d727
commit a5234c16a3
1 changed files with 14 additions and 19 deletions

View File

@ -9,6 +9,7 @@
#include "include/util.h" #include "include/util.h"
#include "include/sdk.h" #include "include/sdk.h"
#include "include/globals.h" #include "include/globals.h"
#include "include/game_detection.h"
cl_entity_t* get_player(int ent_idx) { cl_entity_t* get_player(int ent_idx) {
if (ent_idx < 0 || ent_idx > 32) if (ent_idx < 0 || ent_idx > 32)
@ -35,29 +36,23 @@ bool is_friend(cl_entity_t* ent) {
if (!ent) if (!ent)
return false; return false;
/* Check the current game because this method only works for some games */ GameType game = get_current_game();
switch (this_game_id) {
case TF: { switch (game) {
case GAME_TFC: {
extra_player_info_t* info = (extra_player_info_t*)player_extra_info; 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: { case GAME_CS16: {
extra_player_info_cs_t* info = extra_player_info_cs_t* info = (extra_player_info_cs_t*)player_extra_info;
(extra_player_info_cs_t*)player_extra_info; return info[ent->index].teamnumber == info[localplayer->index].teamnumber;
return info[ent->index].teamnumber ==
info[localplayer->index].teamnumber;
} }
case DOD: { case GAME_DAY_OF_DEFEAT: {
extra_player_info_dod_t* info = extra_player_info_dod_t* info = (extra_player_info_dod_t*)player_extra_info;
(extra_player_info_dod_t*)player_extra_info; return info[ent->index].teamnumber == info[localplayer->index].teamnumber;
return info[ent->index].teamnumber ==
info[localplayer->index].teamnumber;
} }
case HL: case GAME_HALFLIFE:
case GAME_DMC:
default: default:
return false; return false;
} }