Start working on issue
This commit is contained in:
parent
e43a645712
commit
7ed67debfc
@ -56,6 +56,7 @@ namespace Components
|
||||
Loader::Register(new BitMessage());
|
||||
#endif
|
||||
Loader::Register(new FileSystem());
|
||||
Loader::Register(new PlayerName());
|
||||
Loader::Register(new QuickPatch());
|
||||
Loader::Register(new ServerInfo());
|
||||
Loader::Register(new ServerList());
|
||||
|
@ -69,6 +69,7 @@ namespace Components
|
||||
#include "Modules\Singleton.hpp"
|
||||
#include "Modules\BitMessage.hpp"
|
||||
#include "Modules\FileSystem.hpp"
|
||||
#include "Modules\PlayerName.hpp"
|
||||
#include "Modules\QuickPatch.hpp"
|
||||
#include "Modules\ServerInfo.hpp"
|
||||
#include "Modules\ServerList.hpp"
|
||||
|
33
src/Components/Modules/PlayerName.cpp
Normal file
33
src/Components/Modules/PlayerName.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
PlayerName::~PlayerName()
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(PlayerName::PlayerNames); ++i)
|
||||
{
|
||||
PlayerName::PlayerNames[i].clear();
|
||||
}
|
||||
}
|
||||
}
|
18
src/Components/Modules/PlayerName.hpp
Normal file
18
src/Components/Modules/PlayerName.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
namespace Components
|
||||
{
|
||||
class PlayerName : public Component
|
||||
{
|
||||
public:
|
||||
PlayerName();
|
||||
~PlayerName();
|
||||
|
||||
#ifdef DEBUG
|
||||
const char* GetName() { return "PlayerName"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static std::string PlayerNames[18];
|
||||
|
||||
static int GetClientName(int localClientNum, int index, char *buf, int size);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user