Вот вам код infgrenades и NoRecoil надеюсь будет полезно
InfGrenades:
namespace InfGrenades {
inline bool enabled = false;
inline void* grenade_instance = nullptr;
inline bool nuke = false;
inline bool nuke_me = false;
inline bool nuke_enemy = false;
inline bool shoot_grenades = false;
inline bool anti_grenade = false;
inline int grenade_type = 0;
inline int shootgrenade_type = 0;
inline const char* grenades[] = { "HE", "Smoke", "Flash" };
typedef void (*ThrowGrenade_t)(void* grenadeController, int throwType);
inline ThrowGrenade_t orig_ThrowGrenade = nullptr;
typedef void (*ThrowGrenadeEx_t)(void* instance, int type, Vec3 pos, Vec3 dir, float speed, int mode);
inline ThrowGrenadeEx_t ThrowGrenadeEx = nullptr;
typedef void (*GrenadeManager_Update_t)(void* instance);
inline GrenadeManager_Update_t orig_GrenadeManager_Update = nullptr;
template<typename T>
struct monoArray {
void* klass;
void* monitor;
void* bounds;
int max_length;
T data[1];
};
typedef void (*DetonateViaServer_t)(void* instance, monoArray<unsigned char>* data, void* msginfo);
inline DetonateViaServer_t orig_DetonateViaServer = nullptr;
inline void hook_DetonateViaServer(void* instance, monoArray<unsigned char>* data, void* msginfo) {
if (anti_grenade && instance != nullptr) return;
orig_DetonateViaServer(instance, data, msginfo);
}
inline void hook_GrenadeManager_Update(void* instance) {
if (instance != nullptr) {
grenade_instance = instance;
}
if (nuke && ThrowGrenadeEx) {
if (nuke_me && ESP::myPlayer && instance != nullptr) {
void* tr = Functions::GetTransform(ESP::myPlayer);
if (tr) {
Vec3 pos = Functions::GetPosition(tr);
Vec3 throwPos = {pos.x, pos.y + 0.15f, pos.z};
ThrowGrenadeEx(instance, 91 + grenade_type, throwPos, pos, 0.0f, 0);
}
}
if (nuke_enemy && instance != nullptr) {
for (auto& player : ESP::players) {
if (!player || player == ESP::myPlayer) continue;
if (!ESP::IsValidPlayer(player)) continue;
int myTeam = ESP::myPlayer ? ESP::GetTeam(ESP::myPlayer) : -1;
int enemyTeam = ESP::GetTeam(player);
if (enemyTeam == myTeam) continue;
void* tr = Functions::GetTransform(player);
if (tr) {
Vec3 pos = Functions::GetPosition(tr);
Vec3 throwPos = {pos.x, pos.y + 0.15f, pos.z};
ThrowGrenadeEx(instance, 91 + grenade_type, throwPos, pos, 0.0f, 0);
}
}
}
}
if (orig_GrenadeManager_Update) {
orig_GrenadeManager_Update(instance);
}
}
inline void hook_ThrowGrenade(void* grenadeController, int throwType) {
if (enabled && grenadeController) {
void* safeBool = (void*)((uintptr_t)grenadeController + nullptr404(0xE8));
void* safeInt = *(void**)((uintptr_t)safeBool + nullptr404(0x10));
if (safeInt) {
*(int*)((uintptr_t)safeInt + nullptr404(0x10)) = 0;
*(int*)((uintptr_t)safeInt + nullptr404(0x14)) = 1;
}
}
orig_ThrowGrenade(grenadeController, throwType);
}
inline void Init(uintptr_t base) {
A64HookFunction((void*)(base + nullptr404(0xD6B284)),(void*)hook_ThrowGrenade,(void**)&orig_ThrowGrenade);
A64HookFunction((void*)(base + nullptr404(0xD814E4)),(void*)hook_GrenadeManager_Update,(void**)&orig_GrenadeManager_Update);
A64HookFunction((void*)(base + nullptr404(0xD7EB6C)),(void*)hook_DetonateViaServer,(void**)&orig_DetonateViaServer);
ThrowGrenadeEx = (ThrowGrenadeEx_t)(base + nullptr404(0xD7E400));
}
inline void Apply() {
}
}
NoRecoil:
namespace NoRecoil {
inline bool enabled = false;
inline int GetWeaponId(void* player) {
if (!player) return 0;
void* wpnry = *(void**)((uintptr_t)player + nullptr404(0x90));
if (!wpnry) return 0;
void* curr = *(void**)((uintptr_t)wpnry + nullptr404(0x98));
if (!curr) return 0;
void* wpnp = *(void**)((uintptr_t)curr + nullptr404(0x98));
if (!wpnp) return 0;
return *(int*)((uintptr_t)wpnp + nullptr404(0x18));
}
inline void Apply() {
if (!enabled) return;
void* me = ESP::myPlayer;
if (!me) return;
int wpn = GetWeaponId(me);
void* wpnry = *(void**)((uintptr_t)me + nullptr404(0x90));
if (!wpnry) return;
void* curr = *(void**)((uintptr_t)wpnry + nullptr404(0x98));
if (!curr) return;
if (wpn >= 10 && wpn <= 65) {
*(float*)((uintptr_t)curr + nullptr404(0x160)) = 0.0f;
*(float*)((uintptr_t)curr + nullptr404(0x164)) = 0.0f;
void* recoilData = *(void**)((uintptr_t)curr + nullptr404(0xD8));
if (recoilData) {
*(float*)((uintptr_t)recoilData + nullptr404(0x10)) = 0.0f;
*(float*)((uintptr_t)recoilData + nullptr404(0x14)) = 0.0f;
}
void* recoilControl = *(void**)((uintptr_t)curr + nullptr404(0xE8));
if (recoilControl) {
void* rd = *(void**)((uintptr_t)recoilControl + nullptr404(0x38));
if (rd) {
*(float*)((uintptr_t)rd + nullptr404(0x10)) = 0.0f;
*(float*)((uintptr_t)rd + nullptr404(0x14)) = 0.0f;
}
}
void* gunp = *(void**)((uintptr_t)curr + nullptr404(0x180));
if (gunp) {
*(int*)((uintptr_t)gunp + nullptr404(0x94)) = 0;
void* rp = *(void**)((uintptr_t)gunp + nullptr404(0x98));
if (rp) {
*(float*)((uintptr_t)rp + nullptr404(0x10)) = 0.0f;
*(float*)((uintptr_t)rp + nullptr404(0x14)) = 0.0f;
}
*(float*)((uintptr_t)gunp + nullptr404(0xB8)) = 0.0f;
*(float*)((uintptr_t)gunp + nullptr404(0xC0)) = 0.0f;
*(float*)((uintptr_t)gunp + nullptr404(0xC8)) = 0.0f;
}
}
}
}