thelupa1488
Известный
- 13
- 3
Всем привет, сделал показ информации о игроках которые на сервере (id, ping, score, name),
но на некоторых игроках пишет вместо ника, иероглифы.
но на некоторых игроках пишет вместо ника, иероглифы.
C++:
RemotePlayer[i].id = i;
RemotePlayer[i].ping = readMem<int>(Memory.RemotePlayer_PTR + 0x28);
RemotePlayer[i].score = readMem<int>(Memory.RemotePlayer_PTR + 0x24);
RemotePlayer[i].isNpc = readMem<int>(Memory.RemotePlayer_PTR + 0x4);
char remote_name[32];
DWORD oldProtect = 0;
DWORD Address = Memory.RemotePlayer_PTR + 0xC;
VirtualProtectEx(Memory.processHandle, (void*)Address, sizeof(remote_name), PAGE_EXECUTE_READWRITE, &oldProtect);
ReadProcessMemory(Memory.processHandle, (LPVOID)(Address), &remote_name, sizeof(remote_name), NULL);
VirtualProtectEx(Memory.processHandle, (void*)Address, sizeof(remote_name), oldProtect, NULL);
RemotePlayer[i].name = remote_name;
RemotePlayer[i].address = Memory.RemotePlayer_PTR;
C++:
int player = MenuFunction.test;
if (player > REDFIRE_MAX_PLAYER || player < 0)
player = 0;
if (LocalPlayer.id == player) {
sprintf(TestInfo, "Address: %X\nID: %d\nName: %s\nScore: %d\nPing: %d\n", LocalPlayer.address, LocalPlayer.id, LocalPlayer.name.c_str(), LocalPlayer.score, LocalPlayer.ping);
}
else if (RemotePlayer[player].address != NULL) {
sprintf(TestInfo, "Address: %X\nID: %d\nName: %s\nScore: %d\nPing: %d\n", RemotePlayer[player].address, RemotePlayer[player].id, RemotePlayer[player].name.c_str(), RemotePlayer[player].score, RemotePlayer[player].ping);
}
else {
sprintf(TestInfo, "Данный игрок не найден!");
}
DrawStrokeText(200, 200, &White, TestInfo);
C++:
void DrawStrokeText(int x, int y, RGBA* color, const char* str) {
ImFont a;
std::string utf_8_1 = std::string(str);
std::string utf_8_2 = string_To_UTF8(utf_8_1);
ImGui::GetForegroundDrawList()->AddText(ImVec2(x, y - 1), ImGui::ColorConvertFloat4ToU32(ImVec4(1 / 255.0, 1 / 255.0, 1 / 255.0, 255 / 255.0)), utf_8_2.c_str());
ImGui::GetForegroundDrawList()->AddText(ImVec2(x, y + 1), ImGui::ColorConvertFloat4ToU32(ImVec4(1 / 255.0, 1 / 255.0, 1 / 255.0, 255 / 255.0)), utf_8_2.c_str());
ImGui::GetForegroundDrawList()->AddText(ImVec2(x - 1, y), ImGui::ColorConvertFloat4ToU32(ImVec4(1 / 255.0, 1 / 255.0, 1 / 255.0, 255 / 255.0)), utf_8_2.c_str());
ImGui::GetForegroundDrawList()->AddText(ImVec2(x + 1, y), ImGui::ColorConvertFloat4ToU32(ImVec4(1 / 255.0, 1 / 255.0, 1 / 255.0, 255 / 255.0)), utf_8_2.c_str());
ImGui::GetForegroundDrawList()->AddText(ImVec2(x, y), ImGui::ColorConvertFloat4ToU32(ImVec4(color->R / 255.0, color->G / 255.0, color->B / 255.0, color->A / 255.0)), utf_8_2.c_str());
}
C++:
std::string string_To_UTF8(const std::string& str) {
int nwLen = ::MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, NULL, 0);
wchar_t* pwBuf = new wchar_t[nwLen + 1];
ZeroMemory(pwBuf, nwLen * 2 + 2);
::MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), pwBuf, nwLen);
int nLen = ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, -1, NULL, NULL, NULL, NULL);
char* pBuf = new char[nLen + 1];
ZeroMemory(pBuf, nLen + 1);
::WideCharToMultiByte(CP_UTF8, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL);
std::string retStr(pBuf);
delete[]pwBuf;
delete[]pBuf;
pwBuf = NULL;
pBuf = NULL;
return retStr;
}