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

39 lines
921 B
C++
Raw Normal View History

2017-01-19 16:23:59 -05: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()
{
#if(0) // Disabled for now
2017-01-19 16:23:59 -05:00
{
for (int i = 0; i < ARRAYSIZE(PlayerName::PlayerNames); ++i)
2017-01-19 16:23:59 -05:00
{
PlayerName::PlayerNames[i] = "mumu";
}
Utils::Hook(Game::CL_GetClientName, PlayerName::GetClientName, HOOK_JUMP).install()->quick();
}
#endif
//const char* clanname = "ZOB";
//Utils::Hook::Set<const char*>(0x497656, clanname);
//Utils::Hook::Set<const char*>(0x497679, clanname);
2017-01-19 16:23:59 -05:00
}
PlayerName::~PlayerName()
{
for (int i = 0; i < ARRAYSIZE(PlayerName::PlayerNames); ++i)
2017-01-19 16:23:59 -05:00
{
PlayerName::PlayerNames[i].clear();
}
}
}