From 32d15aaa2d00768239eac362de0e4134571cbf9c Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Fri, 6 Aug 2021 12:31:55 +0200 Subject: [PATCH] Fix uses of GetSteamIDForPlayerIndex returning spoofed FriendsID --- src/PlayerTools.cpp | 52 +++++++++++++++++--------------- src/crits.cpp | 4 +-- src/hacks/Announcer.cpp | 16 +++++----- src/hacks/AntiCheat.cpp | 4 +-- src/hacks/AutoTaunt.cpp | 2 +- src/hacks/CatBot.cpp | 6 ++-- src/hacks/CritSay.cpp | 8 ++--- src/hacks/DominateSay.cpp | 8 ++--- src/hacks/ESP.cpp | 2 +- src/hacks/KillSay.cpp | 8 ++--- src/hacks/Killstreak.cpp | 6 ++-- src/hacks/Warp.cpp | 4 +-- src/hacks/ac/aimbot.cpp | 4 +-- src/helpers.cpp | 14 +++++++++ src/hitrate.cpp | 4 +-- src/hooks/others.cpp | 2 +- src/visual/EventLogging.cpp | 24 +++++++-------- src/visual/menu/GuiInterface.cpp | 8 ++--- 18 files changed, 98 insertions(+), 78 deletions(-) diff --git a/src/PlayerTools.cpp b/src/PlayerTools.cpp index 93a8e6af..95e02c03 100644 --- a/src/PlayerTools.cpp +++ b/src/PlayerTools.cpp @@ -128,23 +128,25 @@ void onKilledBy(unsigned id) } } -static CatCommand mark_betrayal("pl_mark_betrayal", "Mark a steamid32 as betrayal", [](const CCommand &args) { - if (args.ArgC() < 2) - { - g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please provide a valid steamid32!"); - return; - } - try - { - // Grab steamid - unsigned steamid = std::stoul(args.Arg(1)); - betrayal_list[steamid] = *betrayal_limit; - } - catch (const std::invalid_argument &) - { - g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Invalid Steamid32 provided."); - } -}); +static CatCommand mark_betrayal("pl_mark_betrayal", "Mark a steamid32 as betrayal", + [](const CCommand &args) + { + if (args.ArgC() < 2) + { + g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please provide a valid steamid32!"); + return; + } + try + { + // Grab steamid + unsigned steamid = std::stoul(args.Arg(1)); + betrayal_list[steamid] = *betrayal_limit; + } + catch (const std::invalid_argument &) + { + g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Invalid Steamid32 provided."); + } + }); void onKilledBy(CachedEntity *entity) { @@ -156,8 +158,8 @@ class PlayerToolsEventListener : public IGameEventListener2 void FireGameEvent(IGameEvent *event) override { - int killer_id = g_IEngine->GetPlayerForUserID(event->GetInt("attacker")); - int victim_id = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int killer_id = GetPlayerForUserID(event->GetInt("attacker")); + int victim_id = GetPlayerForUserID(event->GetInt("userid")); if (victim_id == g_IEngine->GetLocalPlayer()) { @@ -173,9 +175,11 @@ PlayerToolsEventListener &listener() return object; } -static InitRoutine register_event([]() { - g_IEventManager2->AddListener(&listener(), "player_death", false); - EC::Register( - EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener()); }, "playerlist_shutdown"); -}); +static InitRoutine register_event( + []() + { + g_IEventManager2->AddListener(&listener(), "player_death", false); + EC::Register( + EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener()); }, "playerlist_shutdown"); + }); } // namespace player_tools diff --git a/src/crits.cpp b/src/crits.cpp index 59117b3c..d4e0aedd 100644 --- a/src/crits.cpp +++ b/src/crits.cpp @@ -975,7 +975,7 @@ public: // Something took damage else if (!strcmp(event->GetName(), "player_hurt")) { - int victim = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int victim = GetPlayerForUserID(event->GetInt("userid")); int health = event->GetInt("health"); auto &status = player_status_list[victim - 1]; @@ -984,7 +984,7 @@ public: status.just_updated = true; // That something was hurt by us - if (g_IEngine->GetPlayerForUserID(event->GetInt("attacker")) == g_pLocalPlayer->entity_idx) + if (GetPlayerForUserID(event->GetInt("attacker")) == g_pLocalPlayer->entity_idx) { // Don't count self damage if (victim != g_pLocalPlayer->entity_idx) diff --git a/src/hacks/Announcer.cpp b/src/hacks/Announcer.cpp index 21e77999..0bd0ffa5 100644 --- a/src/hacks/Announcer.cpp +++ b/src/hacks/Announcer.cpp @@ -71,8 +71,8 @@ void check_combos() void on_kill(IGameEvent *event) { - int killer_id = g_IEngine->GetPlayerForUserID(event->GetInt("attacker")); - int victim_id = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int killer_id = GetPlayerForUserID(event->GetInt("attacker")); + int victim_id = GetPlayerForUserID(event->GetInt("userid")); if (victim_id == g_IEngine->GetLocalPlayer()) { @@ -122,7 +122,7 @@ void on_kill(IGameEvent *event) void on_spawn(IGameEvent *event) { - int userid = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int userid = GetPlayerForUserID(event->GetInt("userid")); if (userid == g_IEngine->GetLocalPlayer()) { @@ -160,8 +160,10 @@ void shutdown() g_IEventManager2->RemoveListener(&listener()); } -static InitRoutine EC([]() { - EC::Register(EC::Shutdown, shutdown, "shutdown_announcer", EC::average); - init(); -}); +static InitRoutine EC( + []() + { + EC::Register(EC::Shutdown, shutdown, "shutdown_announcer", EC::average); + init(); + }); } // namespace hacks::shared::announcer diff --git a/src/hacks/AntiCheat.cpp b/src/hacks/AntiCheat.cpp index 928c2c92..437daefd 100644 --- a/src/hacks/AntiCheat.cpp +++ b/src/hacks/AntiCheat.cpp @@ -97,13 +97,13 @@ public: if (name == "player_activate") { int uid = event->GetInt("userid"); - int entity = g_IEngine->GetPlayerForUserID(uid); + int entity = GetPlayerForUserID(uid); ResetPlayer(entity); } else if (name == "player_disconnect") { int uid = event->GetInt("userid"); - int entity = g_IEngine->GetPlayerForUserID(uid); + int entity = GetPlayerForUserID(uid); ResetPlayer(entity); } diff --git a/src/hacks/AutoTaunt.cpp b/src/hacks/AutoTaunt.cpp index 369f4beb..72cffac8 100644 --- a/src/hacks/AutoTaunt.cpp +++ b/src/hacks/AutoTaunt.cpp @@ -38,7 +38,7 @@ public: { return; } - if (g_IEngine->GetPlayerForUserID(event->GetInt("attacker")) == g_IEngine->GetLocalPlayer()) + if (GetPlayerForUserID(event->GetInt("attacker")) == g_IEngine->GetLocalPlayer()) { bool nearby = false; for (int i = 1; i <= HIGHEST_ENTITY; i++) diff --git a/src/hacks/CatBot.cpp b/src/hacks/CatBot.cpp index 867dc22b..f7c55c34 100644 --- a/src/hacks/CatBot.cpp +++ b/src/hacks/CatBot.cpp @@ -223,7 +223,7 @@ void do_random_votekick() int target = targets[rand() % targets.size()]; player_info_s info; - if (!GetPlayerInfo(g_IEngine->GetPlayerForUserID(target), &info)) + if (!GetPlayerInfo(GetPlayerForUserID(target), &info)) return; hack::ExecuteCommand("callvote kick \"" + std::to_string(target) + " cheating\""); } @@ -496,8 +496,8 @@ class CatBotEventListener : public IGameEventListener2 void FireGameEvent(IGameEvent *event) override { - int killer_id = g_IEngine->GetPlayerForUserID(event->GetInt("attacker")); - int victim_id = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int killer_id = GetPlayerForUserID(event->GetInt("attacker")); + int victim_id = GetPlayerForUserID(event->GetInt("userid")); if (victim_id == g_IEngine->GetLocalPlayer()) { diff --git a/src/hacks/CritSay.cpp b/src/hacks/CritSay.cpp index abe1f301..e118de6b 100644 --- a/src/hacks/CritSay.cpp +++ b/src/hacks/CritSay.cpp @@ -54,7 +54,7 @@ std::string ComposeCritSay(IGameEvent *event) int kid = event->GetInt("attacker"); if (kid == vid) return ""; - if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) + if (GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return ""; std::string msg = source->at(rand() % source->size()); // checks if the killsays.txt file is not 1 line. 100% sure it's going @@ -63,14 +63,14 @@ std::string ComposeCritSay(IGameEvent *event) msg = source->at(rand() % source->size()); lastmsg = msg; player_info_s info{}; - GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info); + GetPlayerInfo(GetPlayerForUserID(vid), &info); ReplaceSpecials(msg); - CachedEntity *ent = ENTITY(g_IEngine->GetPlayerForUserID(vid)); + CachedEntity *ent = ENTITY(GetPlayerForUserID(vid)); int clz = g_pPlayerResource->GetClass(ent); ReplaceString(msg, "%class%", tf_classes_killsay[clz]); player_info_s infok{}; - GetPlayerInfo(g_IEngine->GetPlayerForUserID(kid), &infok); + GetPlayerInfo(GetPlayerForUserID(kid), &infok); ReplaceString(msg, "%killer%", std::string(infok.name)); ReplaceString(msg, "%team%", tf_teams_killsay[ent->m_iTeam() - 2]); ReplaceString(msg, "%myteam%", tf_teams_killsay[LOCAL_E->m_iTeam() - 2]); diff --git a/src/hacks/DominateSay.cpp b/src/hacks/DominateSay.cpp index 427b4f46..a828f82c 100644 --- a/src/hacks/DominateSay.cpp +++ b/src/hacks/DominateSay.cpp @@ -46,7 +46,7 @@ std::string ComposeDominateSay(IGameEvent *event) int dnum = event->GetInt("dominations"); // this is actually impossible but just in case. - if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) + if (GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return ""; std::string msg = source->at(rand() % source->size()); @@ -56,15 +56,15 @@ std::string ComposeDominateSay(IGameEvent *event) lastmsg = msg; player_info_s info{}; - GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info); + GetPlayerInfo(GetPlayerForUserID(vid), &info); ReplaceSpecials(msg); - CachedEntity *ent = ENTITY(g_IEngine->GetPlayerForUserID(vid)); + CachedEntity *ent = ENTITY(GetPlayerForUserID(vid)); int clz = g_pPlayerResource->GetClass(ent); ReplaceString(msg, "%class%", tf_classes_dominatesay[clz]); player_info_s infok{}; - GetPlayerInfo(g_IEngine->GetPlayerForUserID(kid), &infok); + GetPlayerInfo(GetPlayerForUserID(kid), &infok); ReplaceString(msg, "%dominum%", std::to_string(dnum)); ReplaceString(msg, "%killer%", std::string(infok.name)); diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 48b59cd6..06c69ebf 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -1359,7 +1359,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // Attempt to get player info, and if cant, return player_info_s info; - if (!g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) + if (!GetPlayerInfo(ent->m_IDX, &info)) return; // TODO, check if u can just use "ent->m_bEnemy()" instead of m_iTeam diff --git a/src/hacks/KillSay.cpp b/src/hacks/KillSay.cpp index 7c9040e1..9dc63257 100644 --- a/src/hacks/KillSay.cpp +++ b/src/hacks/KillSay.cpp @@ -59,7 +59,7 @@ std::string ComposeKillSay(IGameEvent *event) int kid = event->GetInt("attacker"); if (kid == vid) return ""; - if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) + if (GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return ""; std::string msg = source->at(rand() % source->size()); // checks if the killsays.txt file is not 1 line. 100% sure it's going @@ -68,14 +68,14 @@ std::string ComposeKillSay(IGameEvent *event) msg = source->at(rand() % source->size()); lastmsg = msg; player_info_s info{}; - GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info); + GetPlayerInfo(GetPlayerForUserID(vid), &info); ReplaceSpecials(msg); - CachedEntity *ent = ENTITY(g_IEngine->GetPlayerForUserID(vid)); + CachedEntity *ent = ENTITY(GetPlayerForUserID(vid)); int clz = g_pPlayerResource->GetClass(ent); ReplaceString(msg, "%class%", tf_classes_killsay[clz]); player_info_s infok{}; - GetPlayerInfo(g_IEngine->GetPlayerForUserID(kid), &infok); + GetPlayerInfo(GetPlayerForUserID(kid), &infok); ReplaceString(msg, "%killer%", std::string(infok.name)); ReplaceString(msg, "%team%", tf_teams_killsay[ent->m_iTeam() - 2]); ReplaceString(msg, "%myteam%", tf_teams_killsay[LOCAL_E->m_iTeam() - 2]); diff --git a/src/hacks/Killstreak.cpp b/src/hacks/Killstreak.cpp index 6a7c1ab9..53a73dda 100644 --- a/src/hacks/Killstreak.cpp +++ b/src/hacks/Killstreak.cpp @@ -62,8 +62,8 @@ void apply_killstreaks() void on_kill(IGameEvent *event) { - int killer_id = g_IEngine->GetPlayerForUserID(event->GetInt("attacker")); - int victim_id = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int killer_id = GetPlayerForUserID(event->GetInt("attacker")); + int victim_id = GetPlayerForUserID(event->GetInt("userid")); if (victim_id == g_IEngine->GetLocalPlayer()) { @@ -91,7 +91,7 @@ void on_kill(IGameEvent *event) void on_spawn(IGameEvent *event) { - int userid = g_IEngine->GetPlayerForUserID(event->GetInt("userid")); + int userid = GetPlayerForUserID(event->GetInt("userid")); if (userid == g_IEngine->GetLocalPlayer()) { diff --git a/src/hacks/Warp.cpp b/src/hacks/Warp.cpp index e679eea3..c4f26e07 100644 --- a/src/hacks/Warp.cpp +++ b/src/hacks/Warp.cpp @@ -1040,8 +1040,8 @@ public: // Store userids int victim = event->GetInt("userid"); int attacker = event->GetInt("attacker"); - int attacker_idx = g_IEngine->GetPlayerForUserID(attacker); - int victim_idx = g_IEngine->GetPlayerForUserID(victim); + int attacker_idx = GetPlayerForUserID(attacker); + int victim_idx = GetPlayerForUserID(victim); player_info_s kinfo{}; player_info_s vinfo{}; diff --git a/src/hacks/ac/aimbot.cpp b/src/hacks/ac/aimbot.cpp index 2970d1b1..a6020ea0 100644 --- a/src/hacks/ac/aimbot.cpp +++ b/src/hacks/ac/aimbot.cpp @@ -105,8 +105,8 @@ void Event(KeyValues *event) { int attacker = event->GetInt("attacker"); int victim = event->GetInt("userid"); - int eid = g_IEngine->GetPlayerForUserID(attacker); - int vid = g_IEngine->GetPlayerForUserID(victim); + int eid = GetPlayerForUserID(attacker); + int vid = GetPlayerForUserID(victim); if (eid > 0 && eid <= MAX_PLAYERS && vid > 0 && vid <= MAX_PLAYERS) { auto &Po_v = Player_origs[vid]; diff --git a/src/helpers.cpp b/src/helpers.cpp index efe2ec4c..5470d88b 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -1957,6 +1957,20 @@ bool GetPlayerInfo(int idx, player_info_s *info) return res; } +int GetPlayerForUserID(int userID) +{ + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) + { + player_info_s player_info; + if (!GetPlayerInfo(i, &player_info)) + continue; + // Found player + if (player_info.userID == userID) + return i; + } + return 0; +} + bool HookNetvar(std::vector path, ProxyFnHook &hook, RecvVarProxyFn function) { auto pClass = g_IBaseClient->GetAllClasses(); diff --git a/src/hitrate.cpp b/src/hitrate.cpp index 768e8564..c9de60c7 100644 --- a/src/hitrate.cpp +++ b/src/hitrate.cpp @@ -68,7 +68,7 @@ void OnShot() void OnHit(bool crit, int idx, bool is_sniper) { - idx = g_IEngine->GetPlayerForUserID(idx); + idx = GetPlayerForUserID(idx); count_hits++; if (is_sniper) count_hits_sniper++; @@ -134,7 +134,7 @@ public: { if (strcmp("player_hurt", event->GetName())) return; - if (g_IEngine->GetPlayerForUserID(event->GetInt("attacker")) == g_IEngine->GetLocalPlayer()) + if (GetPlayerForUserID(event->GetInt("attacker")) == g_IEngine->GetLocalPlayer()) { if (CE_GOOD(LOCAL_W) && (LOCAL_W->m_iClassID() == CL_CLASS(CTFSniperRifle) || LOCAL_W->m_iClassID() == CL_CLASS(CTFSniperRifleDecap))) OnHit(event->GetBool("crit"), event->GetInt("userid"), true); diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 29a50beb..b78be918 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -53,7 +53,7 @@ CatCommand spectate("spectate", "Spectate", [](const CCommand &args) { spectator_target = 0; else { - spectator_target = g_IEngine->GetPlayerForUserID(id); + spectator_target = GetPlayerForUserID(id); } }); diff --git a/src/visual/EventLogging.cpp b/src/visual/EventLogging.cpp index b6192885..e42e90c8 100644 --- a/src/visual/EventLogging.cpp +++ b/src/visual/EventLogging.cpp @@ -34,7 +34,7 @@ static void handlePlayerConnectClient(KeyValues *kv) static void handlePlayerActivate(KeyValues *kv) { int uid = kv->GetInt("userid"); - int entity = g_IEngine->GetPlayerForUserID(uid); + int entity = GetPlayerForUserID(uid); player_info_s info{}; if (GetPlayerInfo(entity, &info)) PrintChat("\x07%06X%s\x01 connected", 0xa06ba0, info.name); @@ -42,7 +42,7 @@ static void handlePlayerActivate(KeyValues *kv) static void handlePlayerDisconnect(KeyValues *kv) { - CachedEntity *player = ENTITY(g_IEngine->GetPlayerForUserID(kv->GetInt("userid"))); + CachedEntity *player = ENTITY(GetPlayerForUserID(kv->GetInt("userid"))); if (player == nullptr || RAW_ENT(player) == nullptr) return; PrintChat("\x07%06X%s\x01 \x07%06X%s\x01 disconnected", colors::chat::team(player->m_iTeam()), kv->GetString("name"), 0x914e65, kv->GetString("networkid")); @@ -69,10 +69,10 @@ static void handlePlayerHurt(KeyValues *kv) int health = kv->GetInt("health"); player_info_s kinfo{}; player_info_s vinfo{}; - if (!GetPlayerInfo(g_IEngine->GetPlayerForUserID(victim), &vinfo) || !GetPlayerInfo(g_IEngine->GetPlayerForUserID(attacker), &kinfo)) + if (!GetPlayerInfo(GetPlayerForUserID(victim), &vinfo) || !GetPlayerInfo(GetPlayerForUserID(attacker), &kinfo)) return; - CachedEntity *vic = ENTITY(g_IEngine->GetPlayerForUserID(victim)); - CachedEntity *att = ENTITY(g_IEngine->GetPlayerForUserID(attacker)); + CachedEntity *vic = ENTITY(GetPlayerForUserID(victim)); + CachedEntity *att = ENTITY(GetPlayerForUserID(attacker)); if (vic == nullptr || att == nullptr || RAW_ENT(vic) == nullptr || RAW_ENT(att) == nullptr) return; @@ -86,10 +86,10 @@ static void handlePlayerDeath(KeyValues *kv) int attacker = kv->GetInt("attacker"); player_info_s kinfo{}; player_info_s vinfo{}; - if (!GetPlayerInfo(g_IEngine->GetPlayerForUserID(victim), &vinfo) || !GetPlayerInfo(g_IEngine->GetPlayerForUserID(attacker), &kinfo)) + if (!GetPlayerInfo(GetPlayerForUserID(victim), &vinfo) || !GetPlayerInfo(GetPlayerForUserID(attacker), &kinfo)) return; - CachedEntity *vic = ENTITY(g_IEngine->GetPlayerForUserID(victim)); - CachedEntity *att = ENTITY(g_IEngine->GetPlayerForUserID(attacker)); + CachedEntity *vic = ENTITY(GetPlayerForUserID(victim)); + CachedEntity *att = ENTITY(GetPlayerForUserID(attacker)); if (vic == nullptr || att == nullptr || RAW_ENT(vic) == nullptr || RAW_ENT(att) == nullptr) return; @@ -101,9 +101,9 @@ static void handlePlayerSpawn(KeyValues *kv) { int id = kv->GetInt("userid"); player_info_s info{}; - if (!GetPlayerInfo(g_IEngine->GetPlayerForUserID(id), &info)) + if (!GetPlayerInfo(GetPlayerForUserID(id), &info)) return; - CachedEntity *player = ENTITY(g_IEngine->GetPlayerForUserID(id)); + CachedEntity *player = ENTITY(GetPlayerForUserID(id)); if (player == nullptr || RAW_ENT(player) == nullptr) return; PrintChat("\x07%06X%s\x01 (re)spawned", colors::chat::team(player->m_iTeam()), info.name); @@ -115,9 +115,9 @@ static void handlePlayerChangeClass(KeyValues *kv) if (id > PLAYER_ARRAY_SIZE || id < 0) return; player_info_s info{}; - if (!GetPlayerInfo(g_IEngine->GetPlayerForUserID(id), &info)) + if (!GetPlayerInfo(GetPlayerForUserID(id), &info)) return; - CachedEntity *player = ENTITY(g_IEngine->GetPlayerForUserID(id)); + CachedEntity *player = ENTITY(GetPlayerForUserID(id)); if (player == nullptr || RAW_ENT(player) == nullptr) return; PrintChat("\x07%06X%s\x01 changed to \x07%06X%s\x01", colors::chat::team(player->m_iTeam()), info.name, 0xa06ba0, classname(kv->GetInt("class"))); diff --git a/src/visual/menu/GuiInterface.cpp b/src/visual/menu/GuiInterface.cpp index db351600..4de8b28c 100644 --- a/src/visual/menu/GuiInterface.cpp +++ b/src/visual/menu/GuiInterface.cpp @@ -20,7 +20,7 @@ static std::unique_ptr controller{ nu static zerokernel::special::PlayerListData createPlayerListData(int userid) { zerokernel::special::PlayerListData data{}; - auto idx = g_IEngine->GetPlayerForUserID(userid); + auto idx = GetPlayerForUserID(userid); player_info_s info{}; GetPlayerInfo(idx, &info); data.classId = g_pPlayerResource->getClass(idx); @@ -76,7 +76,7 @@ void sortPList() player_info_s info{}; if (GetPlayerInfo(i, &info)) { - auto idx = g_IEngine->GetPlayerForUserID(info.userID); + auto idx = GetPlayerForUserID(info.userID); if (g_pPlayerResource->getTeam(idx) == 2) { controller->addPlayer(info.userID, createPlayerListData(info.userID)); @@ -88,7 +88,7 @@ void sortPList() player_info_s info{}; if (GetPlayerInfo(i, &info)) { - auto idx = g_IEngine->GetPlayerForUserID(info.userID); + auto idx = GetPlayerForUserID(info.userID); if (g_pPlayerResource->getTeam(idx) == 3) { controller->addPlayer(info.userID, createPlayerListData(info.userID)); @@ -100,7 +100,7 @@ void sortPList() player_info_s info{}; if (GetPlayerInfo(i, &info)) { - auto idx = g_IEngine->GetPlayerForUserID(info.userID); + auto idx = GetPlayerForUserID(info.userID); if (g_pPlayerResource->getTeam(idx) != 2 && g_pPlayerResource->getTeam(idx) != 3) { controller->addPlayer(info.userID, createPlayerListData(info.userID));