Skip to content

Commit

Permalink
Fix Disable Mission Weapon Checks option
Browse files Browse the repository at this point in the history
Major skill issue from me apparently - I tried getting the ped from the opcode parameters directly instead of getting it from the pool (which is what the original method does) - since I safeguarded the ped pointer in a custom method (`DoesPedHaveWeapon`) it never crashed. In turn, it was never able to properly return whether a ped has a weapon available, resulting in them having NO weapons available when the opcode was called.

Fixes #7
  • Loading branch information
Lordmau5 committed Aug 6, 2024
1 parent ffcbe2f commit 1e8f91c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gtasa/GameHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,19 @@ class GameHandler

script->CollectParameters (2);

CPed *ped = (CPed *) CTheScripts::ScriptParams[0].pParam;
CPed *ped
= CPools::GetPed (CTheScripts::ScriptParams[0].iParam);
eWeaponType weapon
= (eWeaponType) CTheScripts::ScriptParams[1].iParam;

bool hasWeapon = DoesPedHaveWeapon (ped, weapon);

if (weapon == WEAPON_SPRAYCAN) hasWeapon = true;
// Tagging Up Turf fix - the ONLY mission that outright fails if
// you lose the spraycan.
if (weapon == WEAPON_SPRAYCAN)
{
hasWeapon = true;
}

script->UpdateCompareFlag (hasWeapon);
return 0;
Expand Down

0 comments on commit 1e8f91c

Please sign in to comment.