Bug fixes

- Fix crashing issues caused by trying to substring weapon_ prefix when it is not there
- Hopefully reduce lag by moving C4 esp code outside of entity list loop, fix provided by Tucucu on UC forums
This commit is contained in:
ifBars
2023-10-23 22:04:22 -06:00
parent 2e7353ba20
commit 1512e07281
+12 -9
View File
@@ -29,15 +29,6 @@ namespace hack {
const Vector3 localOrigin = process->read<Vector3>(localpCSPlayerPawn + updater::offsets::m_vecOrigin);
int playerIndex = 0;
uintptr_t list_entry;
/**
* Loop through all the players in the entity list
*
* (This could have been done by getting a entity list count from the engine, but I'm too lazy to do that)
**/
while (true) {
bool c4IsPlanted = process->read<bool>(base_client.base + updater::offsets::dwPlantedC4 - 0x8);
if (c4IsPlanted)
{
@@ -74,6 +65,17 @@ namespace hack {
);
}
int playerIndex = 0;
uintptr_t list_entry;
/**
* Loop through all the players in the entity list
*
* (This could have been done by getting a entity list count from the engine, but I'm too lazy to do that)
**/
while (true) {
playerIndex++;
list_entry = process->read<uintptr_t>(entity_list + (8 * (playerIndex & 0x7FFF) >> 9) + 16);
if (!list_entry)
@@ -136,6 +138,7 @@ namespace hack {
char buf[32];
process->read_raw(weaponNameAddress, buf, sizeof(buf));
weaponName = std::string(buf);
if (weaponName.compare(0, 7, "weapon_") == 0)
weaponName = weaponName.substr(7, weaponName.length()); // Remove weapon_ prefix
}