Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __declspec(naked)
- VOID
- KillLocalPlayerAsm(
- VOID
- )
- {
- FLOAT Result;
- __asm {
- push ebp
- mov ebp,esp
- sub esp,28h
- push esi
- ;
- ; Get player base address
- ;
- push 90h
- mov eax,00468550h
- call eax ; ClntObjMgrGetActivePlayer
- push edx ; Player's GUID (HighPart)
- push eax ; Player's GUID (LowPart)
- mov edx,008364B4h ; '..\Object/ObjectClient/Player_C.h'
- mov ecx,10h ; TYPEMASK_PLAYER
- mov eax,00468460h
- call eax ; ClntObjMgrObjectPtr
- ;
- ; (eax) = player base
- mov [ebp-28h],eax
- ;
- ; Initialize CDataStore structure
- ;
- xor esi,esi
- mov [ebp-14h],esi ; m_data
- mov [ebp-10h],esi ; m_base
- mov [ebp-0Ch],esi ; m_alloc
- mov [ebp-8],esi ; m_size
- mov dword ptr [ebp-4],0FFFFFFFFh ; m_read
- mov dword ptr [ebp-18h],007FF9E4h ; CDataStore___vftable_
- ;
- ; Put MSG_MOVE_HEARTBEAT opcode
- ;
- push 0EEh ; MSG_MOVE_HEARTBEAT
- lea ecx,[ebp-18h]
- mov eax,00418190h
- call eax ; CDataStore__PutInt32
- ;
- ; Put the flag
- ;
- xor eax,eax
- push eax ; Flag
- lea ecx,[ebp-18h]
- mov eax,00418190h
- call eax ; CDataStore__PutInt32
- ;
- ; Get timestamp
- ;
- mov eax,0042C010h
- call eax ; OsGetAsyncTimeMs
- ;
- ; (eax) = timestamp
- ;
- ; Put timestamp
- ;
- push eax ; Timestamp
- lea ecx,[ebp-18h]
- mov eax,00418190h
- call eax ; CDataStore__PutInt32
- ;
- ; Get player position address
- ;
- mov ebx,[ebp-28h]
- ;
- ; Put player X-coordinate
- ;
- mov ecx,[ebx+9B8h]
- push ecx ; X-coordinate
- lea ecx,[ebp-18h]
- mov eax,004183D0h
- call eax ; CDataStore__PutFloat
- ;
- ; Put player Y-coordinate
- ;
- mov ecx,[ebx+9BCh]
- push ecx ; Y-coordinate
- lea ecx,[ebp-18h]
- mov eax,004183D0h
- call eax ; CDataStore__PutFloat
- ;
- ; Put player Z-coordinate
- ;
- fld [ebx+9C0h]
- mov eax,00865618h ; [eax] = 100.0f
- fld [eax]
- fadd st(0),st(1) ; Z += 100.0f
- fstp [Result]
- mov ecx,Result
- push ecx ; Z-coordinate
- lea ecx,[ebp-18h]
- mov eax,004183D0h
- call eax ; CDataStore__PutFloat
- ;
- ; Put player facing
- ;
- mov ecx,[ebx+9C4h]
- push ecx ; Facing
- lea ecx,[ebp-18h]
- mov eax,004183D0h
- call eax ; CDataStore__PutFloat
- ;
- ; Put the falltime
- ;
- mov eax,1520
- push eax ; Falltime
- lea ecx,[ebp-18h]
- mov eax,00418190h
- call eax ; CDataStore__PutInt32
- ;
- ; Send the packet
- ;
- lea ecx,[ebp-18h]
- mov [ebp-4],esi
- mov eax,005AB630h
- call eax ; ClientServices_Send
- ;
- ; CleanUp
- ;
- cmp dword ptr [ebp-0Ch],0FFFFFFFFh
- mov dword ptr [ebp-18h],007FF9E4h ; CDataStore___vftable_
- jz Exit
- lea eax,[ebp-0Ch]
- push eax
- lea ecx,[ebp-10h]
- push ecx
- lea edx,[ebp-14h]
- push edx
- lea ecx,[ebp-18h]
- mov eax,007FF9E8h
- call [eax] ; CDataStore__Release
- ;
- ; Send fall land packet
- ;
- xor ebx,ebx
- push ebx ; Unknown1
- push ebx ; Unknown2
- push 0C9h ; Opcode (MSG_MOVE_FALL_LAND)
- mov eax,0042C010h
- call eax ; OsGetAsyncTimeMs
- push eax ; Timestamp
- mov ecx,[ebp-28h] ; Player base
- mov eax,00600A30h
- call eax ; CMovementData_C__SendSimpleMoveMessage
- Exit:
- pop esi
- mov esp,ebp
- pop ebp
- ret
- }
- }
- BOOL
- KillLocalPlayer(
- VOID
- )
- {
- INJDATA InjData;
- PVOID CodeBase;
- RtlZeroMemory(&InjData, sizeof(INJDATA));
- if (!PlayerIsDead()) {
- CodeBase = AllocateVirtualMemory((DWORD_PTR)NULL, SizeOfProc(KillLocalPlayerAsm), MEM_COMMIT | MEM_RESERVE);
- if (CodeBase == NULL) {
- return FALSE;
- }
- WriteBuffer((DWORD_PTR)CodeBase, KillLocalPlayerAsm, SizeOfProc(KillLocalPlayerAsm));
- SuspendThread(hGameThread);
- if (!InjectHooking()) {
- ResumeThread(hGameThread);
- return FALSE;
- }
- InjData.JumpPointer = pEndScene;
- WriteBuffer((DWORD_PTR)EndSceneHook_Parameters, &InjData, sizeof(INJDATA));
- WriteDword((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_PARAMS, (DWORD)EndSceneHook_Parameters);
- WriteByte((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_FUNCTION, 0xE8);
- WriteDword((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_FUNCTION + 1,
- ((DWORD_PTR)CodeBase - ((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_FUNCTION)) - 5);
- ResumeThread(hGameThread);
- Sleep(50);
- AddChatMessage("RIP in Peace, %s!", ReadStringA(0x00C27D88));
- FreeVirtualMemory((DWORD_PTR)CodeBase, 0, MEM_RELEASE);
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement