From 87b605ccaddaed7082454f2010e1218067232f84 Mon Sep 17 00:00:00 2001 From: Vauff Date: Wed, 4 Dec 2024 22:04:31 -0500 Subject: [PATCH] adjustments --- CS2Fixes.vcxproj | 2 +- CS2Fixes.vcxproj.filters | 2 +- cfg/cs2fixes/cs2fixes.cfg | 2 +- src/adminsystem.cpp | 41 -------------------------------------- src/buttonwatch.cpp | 42 ++++++++++++++++++++++++++++++++++++++- src/detours.cpp | 2 +- 6 files changed, 45 insertions(+), 46 deletions(-) diff --git a/CS2Fixes.vcxproj b/CS2Fixes.vcxproj index f8cb6c8a..cd8c2ac9 100644 --- a/CS2Fixes.vcxproj +++ b/CS2Fixes.vcxproj @@ -168,7 +168,7 @@ - + diff --git a/CS2Fixes.vcxproj.filters b/CS2Fixes.vcxproj.filters index 33cfef58..e4c1f32d 100644 --- a/CS2Fixes.vcxproj.filters +++ b/CS2Fixes.vcxproj.filters @@ -173,7 +173,7 @@ Source Files\sdk - + Source Files diff --git a/cfg/cs2fixes/cs2fixes.cfg b/cfg/cs2fixes/cs2fixes.cfg index 48c87020..19059140 100644 --- a/cfg/cs2fixes/cs2fixes.cfg +++ b/cfg/cs2fixes/cs2fixes.cfg @@ -136,4 +136,4 @@ cs2f_idle_kick_min_players 0 // Minimum amount of connected clients to kick id cs2f_idle_kick_admins 1 // Whether to kick idle players with ADMFLAG_GENERIC // Button watch -cs2f_enable_button_watch 0 // CS# BREAKS IF THIS IS EVER ENABLED. Whether to enable button watch or not. +cs2f_enable_button_watch 0 // INCOMPATIBLE WITH CS#. Whether to enable button watch or not. diff --git a/src/adminsystem.cpp b/src/adminsystem.cpp index b6caea42..771fb3a3 100644 --- a/src/adminsystem.cpp +++ b/src/adminsystem.cpp @@ -35,7 +35,6 @@ #include "gamesystem.h" #include "votemanager.h" #include "map_votes.h" -#include "buttonwatch.h" #include extern IVEngineServer2 *g_pEngineServer2; @@ -1127,46 +1126,6 @@ CON_COMMAND_CHAT_FLAGS(add_dc, " - Adds a fake p } #endif -CON_COMMAND_CHAT_FLAGS(bw, "- Toggle button watch display", ADMFLAG_GENERIC) -{ - if (!IsButtonWatchEnabled()) - { - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Button watch is disabled on this server."); - return; - } - - if (!player) - { - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You cannot use this command from the server console."); - return; - } - - ZEPlayer* zpPlayer = player->GetZEPlayer(); - if (!zpPlayer) - { - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Something went wrong, please wait a moment before trying this command again."); - return; - } - - zpPlayer->CycleButtonWatch(); - - switch (zpPlayer->GetButtonWatchMode()) - { - case 0: - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x02 disabled\1 button watch."); - break; - case 1: - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x04 enabled\1 button watch in chat."); - break; - case 2: - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x04 enabled\1 button watch in console."); - break; - case 3: - ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x04 enabled\1 button watch in chat and console."); - break; - } -} - CAdminSystem::CAdminSystem() { LoadAdmins(); diff --git a/src/buttonwatch.cpp b/src/buttonwatch.cpp index 35668c6d..d50c02b3 100644 --- a/src/buttonwatch.cpp +++ b/src/buttonwatch.cpp @@ -32,7 +32,7 @@ #include "cs2fixes.h" #include "commands.h" -CON_COMMAND_F(cs2f_enable_button_watch, "CS# BREAKS IF THIS IS EVER ENABLED. Whether to enable button watch or not.", FCVAR_LINKED_CONCOMMAND | FCVAR_SPONLY | FCVAR_PROTECTED) +CON_COMMAND_F(cs2f_enable_button_watch, "INCOMPATIBLE WITH CS#. Whether to enable button watch or not.", FCVAR_LINKED_CONCOMMAND | FCVAR_SPONLY | FCVAR_PROTECTED) { if (args.ArgC() < 2) { @@ -46,6 +46,46 @@ CON_COMMAND_F(cs2f_enable_button_watch, "CS# BREAKS IF THIS IS EVER ENABLED. Whe mapIOFunctions["buttonwatch"] = ButtonWatch; } +CON_COMMAND_CHAT_FLAGS(bw, "- Toggle button watch display", ADMFLAG_GENERIC) +{ + if (!IsButtonWatchEnabled()) + { + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Button watch is disabled on this server."); + return; + } + + if (!player) + { + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You cannot use this command from the server console."); + return; + } + + ZEPlayer* zpPlayer = player->GetZEPlayer(); + if (!zpPlayer) + { + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Something went wrong, please wait a moment before trying this command again."); + return; + } + + zpPlayer->CycleButtonWatch(); + + switch (zpPlayer->GetButtonWatchMode()) + { + case 0: + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x02 disabled\1 button watch."); + break; + case 1: + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x04 enabled\1 button watch in chat."); + break; + case 2: + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x04 enabled\1 button watch in console."); + break; + case 3: + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You have\x04 enabled\1 button watch in chat and console."); + break; + } +} + bool IsButtonWatchEnabled() { return std::any_of(mapIOFunctions.begin(), mapIOFunctions.end(), [](const auto& p) { diff --git a/src/detours.cpp b/src/detours.cpp index 318b7cef..ee10035d 100644 --- a/src/detours.cpp +++ b/src/detours.cpp @@ -654,7 +654,7 @@ bool SetupFireOutputInternalDetour() CEntityIOOutput_FireOutputInternal = new CDetour(Detour_CEntityIOOutput_FireOutputInternal, "CEntityIOOutput_FireOutputInternal"); if (!CEntityIOOutput_FireOutputInternal->CreateDetour(g_GameConfig)) { - Msg("Failed to detour CEntityIOOutput_FireOutputInternal\n"); + Panic("Failed to detour CEntityIOOutput_FireOutputInternal\n"); delete CEntityIOOutput_FireOutputInternal; CEntityIOOutput_FireOutputInternal = nullptr; return false;