-
Автор темы
- #1
hello,
currently I'm writing my first internal cheat, I'm learning it by reading available dota 2 cheat sources.
my issue is, I have multiple crash in my cheat and I don't know how to fix them.
For example one place that my cheat get crashes is when I'm reading my teammates modifier list and somehow ( Idk how ), it gets invalid ModifierList and it crashes on calling Count. It happens rarely and I don't know exactly why and how (maybe the Hero dies or something? )
Another place that I have the exact same issue:
When I'm iterating over Items, it gets invalidated
currently I'm writing my first internal cheat, I'm learning it by reading available dota 2 cheat sources.
my issue is, I have multiple crash in my cheat and I don't know how to fix them.
C++:
SDK::CDOTAModifierManager* SDK::CDOTABaseNPC::GetModifierManager() const
{
return MemberInline<SDK::CDOTAModifierManager>(Netvars["C_DOTA_BaseNPC"]["m_ModifierManager"]);
}
CUtlVector<SDK::CDOTAModifier*>* SDK::CDOTAModifierManager::GetModifierListRaw() const
{
return MemberInline<CUtlVector<SDK::CDOTAModifier*>>(0x10);
}
void Hacks::DrawTargetAlert()
{
const auto LocalPlayer = (SDK::CDOTAPlayerController*)Interfaces::EntitySystem->GetEntity(Interfaces::IEngineClient->GetLocalPlayer() + 1);
for (const auto& Controller : Globals::Controllers)
{
CDOTABaseNPC_Hero* Hero = (CDOTABaseNPC_Hero*)Interfaces::EntitySystem->GetEntity(H2IDX(Controller->GetAssignedHeroHandle()));
if (!Hero)
continue;
if (LocalPlayer->GetTeam() == Hero->GetTeam())
{
// Invalid modifier list
auto ModifierList = Hero->GetModifierManager()->GetModifierListRaw();
// Error on count();
for (int32_t i = 0; i < ModifierList->Count(); i++
For example one place that my cheat get crashes is when I'm reading my teammates modifier list and somehow ( Idk how ), it gets invalid ModifierList and it crashes on calling Count. It happens rarely and I don't know exactly why and how (maybe the Hero dies or something? )
Another place that I have the exact same issue:
C++:
std::array<Handle, 19> SDK::CDOTAUnitInventory::GetItemHandles() const
{
auto span = std::span<Handle, 19>{ MemberInline<Handle>(Netvars["C_DOTA_UnitInventory"]["m_hItems"]), 19 };
}
std::vector<SDK::CDOTAItem*> SDK::CDOTAUnitInventory::GetInHandItems() const
{
std::vector<CDOTAItem*> Items;
auto ItemsHandle = GetItemHandles();
for (int i = 0; i <= 5; i++)
{
if (HVALID(ItemsHandle[i]))
{
auto Item = (CDOTAItem*)Interfaces::EntitySystem->GetEntity(H2IDX(ItemsHandle[i]));
Items.push_back(Item);
}
}
return Items;
}
SDK::CDOTAItem* SDK::CDOTAUnitInventory::GetItem(const char* ItemName) const
{
auto Items = GetInHandItems();
for (auto& Item : Items)
{
if (!Item) // It's wrong. but what should I do?
continue;
if (strstr(Item->GetIdentity()->GetName(), ItemName))
returnItem;
}
return nullptr;
}