[CardTitles] Changed command index.

This commit is contained in:
RektInator 2017-05-31 01:42:25 +02:00
parent 6f71a65a83
commit 0661972f68
3 changed files with 8 additions and 14 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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();
}
});