zxc_paranoik
Новичок
- 2
- 0
я так понимаю эти адреса уже есть под R1 или какую-то еще версию, скинь их, не понятно, что именно нужноМне нужны адреса памяти, может они у кого-то есть, если поделитесь, было бы здорово:
C++:SAMP_F1_KEYHANDLER - Нужный 0.3.7-R2 | 0.3.7-R4 | 0.3.7-R5 | SAMP 0.3DL SAMP_ANTI_CRASHER - Нужный 0.3.7-R5 SAMP_FPS_UNLOCK - Нужный 0.3.7-R4 | 0.3.7-R5 sampPatch[] = "No connecting delay" - Нужный 0.3.7-R2 | 0.3.7-R3 | 0.3.7-R4
#include <Windows.h>
#include <iostream>
#include <memory>
#include <kthook/kthook.hpp>
using CTimer__UpdateSignature = void(__cdecl*)();
using WndProcSignature = HRESULT(__stdcall*)(HWND, UINT, WPARAM, LPARAM);
using InitGameInstance = HWND(__cdecl*)(HINSTANCE);
kthook::kthook_simple<CTimer__UpdateSignature> CTimerHook{};
kthook::kthook_signal<InitGameInstance> hookGameInstanceInit{ 0x745560 };
kthook::kthook_simple<WndProcSignature> WndProcHook{};
HWND gameHwnd = []() {
HWND* pHwnd = *reinterpret_cast<HWND**>(0xC17054);
if (pHwnd != nullptr) {
return *pHwnd;
}
else {
hookGameInstanceInit.after += [](const auto& hook, HWND& returnValue, HINSTANCE inst) {
gameHwnd = returnValue;
};
return HWND(0);
}
}();
HRESULT hWndProc(const decltype(WndProcHook)& hook, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
std::cout << "WndProcHook hooked." << std::endl;
if (uMsg == WM_KEYUP) {
if (wParam == VK_F9) {
MessageBoxA(NULL, "¡Test!", "¡Test!", MB_OK);
}
}
return hook.get_trampoline()(hwnd, uMsg, wParam, lParam);
}
void setUpHooks() {
auto pLatestWndproc = GetWindowLongPtrA(gameHwnd, GWLP_WNDPROC);
WndProcHook.set_dest(pLatestWndproc);
WndProcHook.set_cb(&hWndProc);
WndProcHook.install();
}
void CTimer__Update(const decltype(CTimerHook)& hook) {
static bool init{};
if (!init) {
setUpHooks();
init = { true };
}
hook.get_trampoline()();
}
Где установка хука CTimer::Update?Почему крючок не работает?
C++:#include <Windows.h> #include <iostream> #include <memory> #include <kthook/kthook.hpp> using CTimer__UpdateSignature = void(__cdecl*)(); using WndProcSignature = HRESULT(__stdcall*)(HWND, UINT, WPARAM, LPARAM); using InitGameInstance = HWND(__cdecl*)(HINSTANCE); kthook::kthook_simple<CTimer__UpdateSignature> CTimerHook{}; kthook::kthook_signal<InitGameInstance> hookGameInstanceInit{ 0x745560 }; kthook::kthook_simple<WndProcSignature> WndProcHook{}; HWND gameHwnd = []() { HWND* pHwnd = *reinterpret_cast<HWND**>(0xC17054); if (pHwnd != nullptr) { return *pHwnd; } else { hookGameInstanceInit.after += [](const auto& hook, HWND& returnValue, HINSTANCE inst) { gameHwnd = returnValue; }; return HWND(0); } }(); HRESULT hWndProc(const decltype(WndProcHook)& hook, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { std::cout << "WndProcHook hooked." << std::endl; if (uMsg == WM_KEYUP) { if (wParam == VK_F9) { MessageBoxA(NULL, "¡Test!", "¡Test!", MB_OK); } } return hook.get_trampoline()(hwnd, uMsg, wParam, lParam); } void setUpHooks() { auto pLatestWndproc = GetWindowLongPtrA(gameHwnd, GWLP_WNDPROC); WndProcHook.set_dest(pLatestWndproc); WndProcHook.set_cb(&hWndProc); WndProcHook.install(); } void CTimer__Update(const decltype(CTimerHook)& hook) { static bool init{}; if (!init) { setUpHooks(); init = { true }; } hook.get_trampoline()(); }
Где установка хука CTimer::Update?
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
CTimerHook.set_dest(0x561B10);
CTimerHook.set_cb(&CTimer__Update);
CTimerHook.install();
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
bool PluginRPC::onShowTextDraw(unsigned char& id, RakNet::BitStream* bs) {
if (id != 134) {
return true;
}
uint16_t wTextDrawID;
uint8_t Flags;
float fLetterWidth;
float fLetterHeight;
uint32_t dLetterColor;
float fLineWidth;
float fLineHeight;
uint32_t dBoxColor;
uint8_t Shadow;
uint8_t Outline;
uint32_t dBackgroundColor;
uint8_t Style;
uint8_t Selectable;
float fX;
float fY;
uint16_t wModelID;
float fRotX;
float fRotY;
float fRotZ;
float fZoom;
int16_t wColor1;
int16_t wColor2;
uint16_t szTextLen;
std::string szText;
bs->Read(wTextDrawID);
bs->Read(Flags);
bs->Read(fLetterWidth);
bs->Read(fLetterHeight);
bs->Read(dLetterColor);
bs->Read(fLineWidth);
bs->Read(fLineHeight);
bs->Read(dBoxColor);
bs->Read(Shadow);
bs->Read(Outline);
bs->Read(dBackgroundColor);
bs->Read(Style);
bs->Read(Selectable);
bs->Read(fX);
bs->Read(fY);
bs->Read(wModelID);
bs->Read(fRotX);
bs->Read(fRotY);
bs->Read(fRotZ);
bs->Read(fZoom);
bs->Read(wColor1);
bs->Read(wColor2);
bs->Read(szTextLen);
szText.resize(szTextLen);
bs->Read(szText.data(), szTextLen);
if (wTextDrawID == 2053) {
std::string gasolina = szText;
std::string gasolinaValue = gasolina;
size_t startPos = gasolina.find("{");
size_t endPos = gasolina.find("}");
if (startPos != std::string::npos && endPos != std::string::npos) {
gasolinaValue = gasolina.substr(startPos + 1, endPos - startPos - 1);
}
std::cout << "Gasolina value: " << gasolinaValue << std::endl;
}
return true;
}
Для начала тебе стоит выучить базовый синтаксис языка, поэтому вписываешь в ютубе что-то вроде "курс C++ для новичка" и смотришь пару видео. Далее можешь начать читать книжку, лично я читал (но так и не дочитал) Лоспинозо - C++ для профи. Молниеносный старт (2021). Потом смотришь чужой код, на том же бластхаке и постепенно пишешь свои проектыС чего лучше начать изучения языка , желательно видеоролики.
RPC TextDrawSetString? id 105Is there a way to get the string from a textdraw in a loop using RakHook?
Есть ли способ получить строку из зацикленного текстового рисунка с помощью RakHook?
This only works the first time the textdraw is displayed, using while will cause the game to freeze.
Это работает только при первом отображении textdraw, использование while приведет к зависанию игры.
C++:bool PluginRPC::onShowTextDraw(unsigned char& id, RakNet::BitStream* bs) { if (id != 134) { return true; } uint16_t wTextDrawID; uint8_t Flags; float fLetterWidth; float fLetterHeight; uint32_t dLetterColor; float fLineWidth; float fLineHeight; uint32_t dBoxColor; uint8_t Shadow; uint8_t Outline; uint32_t dBackgroundColor; uint8_t Style; uint8_t Selectable; float fX; float fY; uint16_t wModelID; float fRotX; float fRotY; float fRotZ; float fZoom; int16_t wColor1; int16_t wColor2; uint16_t szTextLen; std::string szText; bs->Read(wTextDrawID); bs->Read(Flags); bs->Read(fLetterWidth); bs->Read(fLetterHeight); bs->Read(dLetterColor); bs->Read(fLineWidth); bs->Read(fLineHeight); bs->Read(dBoxColor); bs->Read(Shadow); bs->Read(Outline); bs->Read(dBackgroundColor); bs->Read(Style); bs->Read(Selectable); bs->Read(fX); bs->Read(fY); bs->Read(wModelID); bs->Read(fRotX); bs->Read(fRotY); bs->Read(fRotZ); bs->Read(fZoom); bs->Read(wColor1); bs->Read(wColor2); bs->Read(szTextLen); szText.resize(szTextLen); bs->Read(szText.data(), szTextLen); if (wTextDrawID == 2053) { std::string gasolina = szText; std::string gasolinaValue = gasolina; size_t startPos = gasolina.find("{"); size_t endPos = gasolina.find("}"); if (startPos != std::string::npos && endPos != std::string::npos) { gasolinaValue = gasolina.substr(startPos + 1, endPos - startPos - 1); } std::cout << "Gasolina value: " << gasolinaValue << std::endl; } return true; }
Пишет что ссылка не доступна , скинь на гугл дискДля начала тебе стоит выучить базовый синтаксис языка, поэтому вписываешь в ютубе что-то вроде "курс C++ для новичка" и смотришь пару видео. Далее можешь начать читать книжку, лично я читал (но так и не дочитал) Лоспинозо - C++ для профи. Молниеносный старт (2021). Потом смотришь чужой код, на том же бластхаке и постепенно пишешь свои проекты
Попробуй на постоянке изменятькак сделать быстрый бег игроку, именно ускорить бег персонажа, а не ускорить всю игру или бег CJ.
ped->m_pPlayerData->m_fMoveSpeedFindPlayerPed()->m_pPlayerData->m_fMoveSpeed = 0.f;
using addBullet = bool(__cdecl*)(CEntity*, eWeaponType, CVector, CVector);
constructor() {
std::uintptr_t base = reinterpret_cast<std::uintptr_t>(GetModuleHandleA("samp.dll"));
kthook::kthook_simple<addBullet>(bullet);
bullet.set_cb([](const auto& hook, CEntity* eShooter, eWeaponType weaponType, CVector vecPosition, CVector vecVelocity) {
sampapi::v037r1::RefChat()->AddMessage(-1, (std::to_string((int)weaponType)).c_str());
return hook.get_trampoline()(eShooter, weaponType, vecPosition, vecVelocity);
});
bullet.set_dest(base + 0xA0BB0);
bullet.install();
}
В чит энджине смотрел, там стоит на месте Хука джамп на аллоциированный адрес и по которому можно будет увидеть следы твоего плагина (в случае ктхука) ?Ставлю хук, но он не срабатывает при выстреле, в чем проблема может быть?
C++:using addBullet = bool(__cdecl*)(CEntity*, eWeaponType, CVector, CVector); constructor() { std::uintptr_t base = reinterpret_cast<std::uintptr_t>(GetModuleHandleA("samp.dll")); kthook::kthook_simple<addBullet>(bullet); bullet.set_cb([](const auto& hook, CEntity* eShooter, eWeaponType weaponType, CVector vecPosition, CVector vecVelocity) { sampapi::v037r1::RefChat()->AddMessage(-1, (std::to_string((int)weaponType)).c_str()); return hook.get_trampoline()(eShooter, weaponType, vecPosition, vecVelocity); }); bullet.set_dest(base + 0xA0BB0); bullet.install(); }