iw4x-client/src/Components/Modules/PlayerName.cpp

34 lines
843 B
C++
Raw Normal View History

2016-09-05 13:55:47 -04:00
#include "STDInclude.hpp"
namespace Components
{
std::string PlayerName::PlayerNames[18];
int PlayerName::GetClientName(int /*localClientNum*/, int index, char *buf, int size)
{
if (index < 0 || index >= 18) return 0;
return strncpy_s(buf, size, PlayerName::PlayerNames[index].data(), PlayerName::PlayerNames[index].size()) == 0;
}
PlayerName::PlayerName()
{
2016-09-05 13:57:17 -04:00
if (0) // Disabled for now (comment out that line to enable it)
2016-09-05 13:55:47 -04:00
{
for (int i = 0; i < ARRAY_SIZE(PlayerName::PlayerNames); ++i)
{
PlayerName::PlayerNames[i] = "mumu";
}
Utils::Hook(Game::CL_GetClientName, PlayerName::GetClientName, HOOK_JUMP).install()->quick();
2016-09-05 13:55:47 -04:00
}
}
PlayerName::~PlayerName()
{
for (int i = 0; i < ARRAY_SIZE(PlayerName::PlayerNames); ++i)
{
PlayerName::PlayerNames[i].clear();
}
}
}