Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "plugin.h"
- #include "../injector/injector.hpp"
- static int _Z16FindPlayetWantedj = 0x56E230;
- static int _Z13FindPlayerPedj = 0x56E210;
- static int _ZN4CPed23DoWeHaveWeaponAvailableE11eWeaponType = 0x5DF300;
- static int _ZN11CWeaponInfo13GetWeaponInfoE11eWeaponTypea = 0x743C60;
- static int _ZN4CPed16SetCurrentWeaponE11eWeaponType = 0x5E6280;
- __declspec(naked) void NewFunction() {
- _asm {
- push esi
- push -1
- call _Z16FindPlayetWantedj
- mov eax,[eax+0x2C]
- mov esi,[esp+0x0C]
- add esp,4
- cmp eax,1
- jle loc_68BB03
- movsx ecx,byte ptr [esi+0x718]
- imul ecx,ecx,0x1C
- mov edx,[ecx+esi+0x5A0]
- test edx,edx
- je loc_68BB9C
- cmp eax,1
- loc_68BB03:
- jne loc_68BBBD
- push -1
- call _Z13FindPlayerPedj
- mov ecx,[eax+0x568]
- add esp,4
- test ecx,ecx
- jne loc_68BBBD
- cmp dword ptr [esi+0x530],31
- je loc_68BBBD
- push 3
- mov ecx,esi
- call _ZN4CPed23DoWeHaveWeaponAvailableE11eWeaponType
- test al,al
- je loc_68BB9C
- push -1
- call _Z13FindPlayerPedj
- movsx edx,byte ptr [eax+0x718]
- imul edx,edx,0x1C
- mov eax,[edx+eax+0x5A0]
- push 1
- push eax
- call _ZN11CWeaponInfo13GetWeaponInfoE11eWeaponTypea
- mov ecx,[eax]
- add esp,0x0C
- cmp ecx,1
- je loc_68BB9C
- push -1
- call _Z13FindPlayerPedj
- movsx ecx,byte ptr [eax+0x718]
- imul ecx,ecx,0x1C
- mov eax,[ecx+eax+0x5A0]
- push 1
- push eax
- call _ZN11CWeaponInfo13GetWeaponInfoE11eWeaponTypea
- mov ecx,[eax]
- add esp,0x0C
- cmp ecx,2
- je loc_68BB9C
- push 3
- mov ecx,esi
- call _ZN4CPed16SetCurrentWeaponE11eWeaponType
- pop esi
- ret 4
- loc_68BB9C:
- push 19
- mov ecx,esi
- call _ZN4CPed23DoWeHaveWeaponAvailableE11eWeaponType
- test al,al
- mov ecx,esi
- je loc_68BBB6
- push 19
- call _ZN4CPed16SetCurrentWeaponE11eWeaponType
- pop esi
- ret 4
- loc_68BBB6:
- push 16
- call _ZN4CPed16SetCurrentWeaponE11eWeaponType
- loc_68BBBD:
- pop esi
- ret 4
- }
- }
- using namespace plugin;
- class TheNewProject {
- public:
- TheNewProject() {
- Events::gameProcessEvent += [] {
- plugin::patch::Nop(0x68BAD0, 8);
- injector::MakeJMP(0x68BAD0, NewFunction);
- };
- }
- } theNewProject;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement