-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpositionloader.cpp
More file actions
54 lines (43 loc) · 1.22 KB
/
positionloader.cpp
File metadata and controls
54 lines (43 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "plugin.h"
static CVector3f currentPos;
static CVector3f savedPos;
static bool hasSaved = false;
void PositionLoader(void* self)
{
CCharacter* ch = *(CCharacter**)((uintptr_t)self + 0x20);
CGameObject* playerObj = NULL;
if (GetAsyncKeyState(VK_F9))
{
CMatrix4f mat;
//Find player or vehicle
CVehicle* playerCar = ch->GetVehiclePtr();
if (playerCar)
playerObj = playerCar;
else
playerObj = ch;
//Get Transform Properties for player or vehicle
playerObj->GetTransform(&mat);
//save position
currentPos = mat.Position();
savedPos = currentPos;
hasSaved = true;
}
if (GetAsyncKeyState(VK_F10))
{
CMatrix4f mat;
//Find player or vehicle
CVehicle* playerCar = ch->GetVehiclePtr();
if (playerCar)
playerObj = playerCar;
else
playerObj = ch;
//Get Transform Properties for player or vehicle
playerObj->GetTransform(&mat);
//Check to see if position has been saved before
if (hasSaved)
{
mat.SetPosition(savedPos);
playerObj->SetTransform(&mat);
}
}
}