#include #include #include void MainFunc() { fxn::invoker_base::initialize("vcruntime140_1.dll"); constexpr auto GIVE_WEAPON_TO_PED = 0xB41DEC3AAC1AA107; fxn::native_hooker<0xB41DEC3AAC1AA107> giveWeaponHook([](fxn::NativeContext* context, bool& callOriginal) -> bool { auto pedId = context->GetArgument(0); auto weaponHash = context->GetArgument(1); auto ammoCount = context->GetArgument(2); auto isHidden = context->GetArgument(3); auto bForceInHand = context->GetArgument(4); printf("GiveWeaponToPed Hooked! PedID: %d, WeaponHash: 0x%X, AmmoCount: %d, IsHidden: %d, ForceInHand: %d\n", pedId, weaponHash, ammoCount, isHidden, bForceInHand); // Allow original function to be called callOriginal = true; return true; }); while (!GetAsyncKeyState(VK_END)) { if (GetAsyncKeyState(VK_F1)) { auto playerPedId = fxn::invoker<0x4A8C381C258A124D, int>::invoke(); printf("Player Ped ID: %d\n", playerPedId); auto weaponHash = fxn::HashString("WEAPON_PISTOL"); fxn::invoker<0xB41DEC3AAC1AA107, void, int, unsigned int, int, bool, bool>::invoke( playerPedId, weaponHash, 250, true, true ); Sleep(500); // Debounce } Sleep(10); } } DWORD ThreadMain(LPVOID lpParam) { FILE* fp; AllocConsole(); freopen_s(&fp, "CONOUT$", "w", stdout); HMODULE hModule = (HMODULE)lpParam; MainFunc(); FreeConsole(); if (fp) { fclose(fp); } FreeLibraryAndExitThread(hModule, 0); return 0; } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { HANDLE hThread = CreateThread(NULL, NULL, ThreadMain, hModule, NULL, NULL); if (hThread) { CloseHandle(hThread); } } return TRUE; }