Advertisement
HolywoodJack

goodCitizenBonusFix_cpp

Jun 25th, 2021 (edited)
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. #include "plugin.h"
  2. #include "extensions\ScriptCommands.h"
  3.  
  4. using namespace plugin;
  5.  
  6. static int _ZN9CMessages13AddBigMessageEPhjt_2 = 0x69F2B0;
  7. int chasingCop = 0;
  8.  
  9. __declspec(naked) void goodCitizenFixer_asm() { // 0x66B477
  10. _asm {
  11. mov chasingCop, esi
  12. mov eax,[esi+0x47C]
  13. pushad
  14. add esi,0x46C
  15. mov eax,esi
  16. mov edx,esi
  17. mov edx,[edx]
  18. or edx,0x800000
  19. mov [eax],edx
  20. popad
  21. push 0x66B47D
  22. ret
  23. }
  24. }
  25.  
  26. __declspec(naked) void removeFlag_asm() { // 0x5320CD
  27. _asm {
  28. pushad
  29. mov esi,[esp+0x54]
  30. add esi,0x46C
  31. mov eax,esi
  32. mov edx,esi
  33. mov edx,[edx]
  34. and edx,0xFF7FFFFF // -0x800000
  35. mov [eax],edx
  36. popad
  37. push _ZN9CMessages13AddBigMessageEPhjt_2
  38. ret
  39. }
  40. }
  41.  
  42. class GoodCitizenBonusFix {
  43. public:
  44. GoodCitizenBonusFix() {
  45.  
  46. injector::MakeJMP(0x66B477, goodCitizenFixer_asm);
  47. patch::RedirectCall(0x5320CD, removeFlag_asm);
  48.  
  49. Events::gameProcessEvent += [] {
  50. Command<0x0ADF>("GOODBOY", "$50 GOOD CITIZEN BONUS!"); // COMMAND_ADD_TEXT_LABEL
  51. if (chasingCop) {
  52. CPed *chasingCopPed = reinterpret_cast<CPed *>(chasingCop);
  53. }
  54.  
  55. for (int i = 0; i < CPools::ms_pPedPool->m_nSize; i++) {
  56. CPed *ped = CPools::ms_pPedPool->GetAt(i);
  57. if (ped) {
  58. if (ped->m_nPedFlags.bBeingChasedByPolice) {
  59.  
  60. }
  61. // ped->m_nPedFlags.bBeingChasedByPolice = 1;
  62. }
  63. }
  64. };
  65. }
  66. } goodCitizenBonusFix;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement