From 0661972f68928ee4903d09dbdfbc5209281c8363 Mon Sep 17 00:00:00 2001 From: RektInator Date: Wed, 31 May 2017 01:42:25 +0200 Subject: [PATCH] [CardTitles] Changed command index. --- src/Components/Modules/CardTitles.cpp | 14 +++++--------- src/Components/Modules/CardTitles.hpp | 5 +---- src/Components/Modules/Dedicated.cpp | 3 ++- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Components/Modules/CardTitles.cpp b/src/Components/Modules/CardTitles.cpp index 2aa7929b..6c3fd8b4 100644 --- a/src/Components/Modules/CardTitles.cpp +++ b/src/Components/Modules/CardTitles.cpp @@ -150,11 +150,11 @@ namespace Components for (int i = 0; i < 18; i++) { - char playerTitle[18] = { 0 }; + char playerTitle[18]; if (Game::svs_clients[i].state >= 3) { - strncpy_s(playerTitle, Game::Info_ValueForKey(Game::svs_clients[i].connectInfoString, "customTitle"), 18); + strncpy_s(playerTitle, Game::Info_ValueForKey(Game::svs_clients[i].connectInfoString, "customTitle"), 17); } else { @@ -164,7 +164,7 @@ namespace Components list = Utils::String::VA("%s\\%s\\%s", list, std::to_string(i).c_str(), playerTitle); } - list = Utils::String::VA("%c customTitles \"%s", 20, list); + list = Utils::String::VA("%c customTitles \"%s\"", 21, list); Game::SV_GameSendServerCommand(-1, 0, list); } @@ -189,10 +189,10 @@ namespace Components CardTitles::CardTitles() { Dvar::OnInit([]() { - CardTitles::CustomTitleDvar = Game::Dvar_RegisterString("cardtitle", "", Game::dvar_flag::DVAR_FLAG_SAVED, "Custom card title"); + CardTitles::CustomTitleDvar = Game::Dvar_RegisterString("customtitle", "", Game::dvar_flag::DVAR_FLAG_USERINFO | Game::dvar_flag::DVAR_FLAG_SAVED, "Custom card title"); }); - ServerCommands::OnCommand(20, [](Command::Params* params) { + ServerCommands::OnCommand(21, [](Command::Params* params) { if (params->get(1) == "customTitles"s && !Flags::HasFlag("dedicated")) { @@ -211,10 +211,6 @@ namespace Components Utils::Hook(0x62EB26, GetPlayerCardClientInfoStub).install()->quick(); - // Translation fixup - // Utils::Hook(0x63A2D9, LocalizationSkipHookStub).install()->quick(); - // Utils::Hook::Nop(0x63A2D5, 3); - // Table lookup stuff Utils::Hook(0x62DCC1, TableLookupByRowHookStub).install()->quick(); Utils::Hook::Nop(0x62DCC6, 1); diff --git a/src/Components/Modules/CardTitles.hpp b/src/Components/Modules/CardTitles.hpp index 4e154b74..eecdf7d8 100644 --- a/src/Components/Modules/CardTitles.hpp +++ b/src/Components/Modules/CardTitles.hpp @@ -54,6 +54,7 @@ namespace Components { public: static Game::dvar_t* CustomTitleDvar; + static std::vector < std::string > CustomTitles; static void SendCustomTitlesToClients(); static void ParseCustomTitles(const char * msg); @@ -62,13 +63,9 @@ namespace Components ~CardTitles(); private: - static std::vector < std::string > CustomTitles; - static CClient * GetClientByIndex(std::uint32_t index); static std::int32_t GetPlayerCardClientInfo(std::int32_t lookupResult, playercarddata_s * data); static void GetPlayerCardClientInfoStub(); - static const char* LocalizationSkipHook(const char * string); - static void LocalizationSkipHookStub(); static const char* TableLookupByRowHook(Game::Operand * operand, tablelookuprequest_s * request); static void TableLookupByRowHookStub(); diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index a711e1a6..0b60526d 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -457,9 +457,10 @@ namespace Components { static std::uint64_t LastUpdate = 0; - if ((GetTickCount64() - LastUpdate) > 120 * 1000) + if ((GetTickCount64() - LastUpdate) > 10000) { CardTitles::SendCustomTitlesToClients(); + LastUpdate = GetTickCount64(); } });