File size: 8,311 Bytes
7e9dc27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
--[[
	Project: SA Memory (Available from https://blast.hk/)
	Developers: LUCHARE, FYP

	Special thanks:
		plugin-sdk (https://github.com/DK22Pac/plugin-sdk) for the structures and addresses.

	Copyright (c) 2018 BlastHack.
]]

local shared = require 'SAMemory.shared'

shared.require 'RenderWare'
shared.require 'CPhysical'
shared.require 'CAEPedAudioEntity'
shared.require 'CAEPedSpeechAudioEntity'
shared.require 'CAEWeaponAudioEntity'
shared.require 'CPedIntelligence'
shared.require 'CPlayerData'
shared.require 'AnimBlendFrameData'
shared.require 'CPedAcquaintance'
shared.require 'CPedIK'
shared.require 'ePedState'
shared.require 'CEntity'
shared.require 'CVehicle'
shared.require 'CWeapon'
shared.require 'eWeaponType'
shared.require 'CObject'
shared.require 'CFire'
shared.require 'vector2d'
shared.require 'vector3d'

shared.ffi.cdef[[
	typedef struct CVehicle CVehicle;

	typedef struct CPed : CPhysical
	{
		CAEPedAudioEntity					pedAudio;
		CAEPedSpeechAudioEntity		pedSpeech;
		CAEWeaponAudioEntity				weaponAudio;
		char field_43C[36];
		char field_460[8];
		int field_468;
		struct
		{
			unsigned int bIsStanding : 1;
			unsigned int bWasStanding : 1;
			unsigned int bIsLooking : 1;
			unsigned int bIsRestoringLook : 1;
			unsigned int bIsAimingGun : 1;
			unsigned int bIsRestoringGun : 1;
			unsigned int bCanPointGunAtTarget : 1;
			unsigned int bIsTalking : 1;

			unsigned int bInVehicle : 1;
			unsigned int bIsInTheAir : 1;
			unsigned int bIsLanding : 1;
			unsigned int bHitSomethingLastFrame : 1;
			unsigned int bIsNearCar : 1;
			unsigned int bRenderPedInCar : 1;
			unsigned int bUpdateAnimHeading : 1;
			unsigned int bRemoveHead : 1;

			unsigned int bFiringWeapon : 1;
			unsigned int bHasACamera : 1;
			unsigned int bPedIsBleeding : 1;
			unsigned int bStopAndShoot : 1;
			unsigned int bIsPedDieAnimPlaying : 1;
			unsigned int bStayInSamePlace : 1;
			unsigned int bKindaStayInSamePlace : 1;
			unsigned int bBeingChasedByPolice : 1;

			unsigned int bNotAllowedToDuck : 1;
			unsigned int bCrouchWhenShooting : 1;
			unsigned int bIsDucking : 1;
			unsigned int bGetUpAnimStarted : 1;
			unsigned int bDoBloodyFootprints : 1;
			unsigned int bDontDragMeOutCar : 1;
			unsigned int bStillOnValidPoly : 1;
			unsigned int bAllowMedicsToReviveMe : 1;

			unsigned int bResetWalkAnims : 1;
			unsigned int bOnBoat : 1;
			unsigned int bBusJacked : 1;
			unsigned int bFadeOut : 1;
			unsigned int bKnockedUpIntoAir : 1;
			unsigned int bHitSteepSlope : 1;
			unsigned int bCullExtraFarAway : 1;
			unsigned int bTryingToReachDryLand : 1;

			unsigned int bCollidedWithMyVehicle : 1;
			unsigned int bRichFromMugging : 1;
			unsigned int bChrisCriminal : 1;
			unsigned int bShakeFist : 1;
			unsigned int bNoCriticalHits : 1;
			unsigned int bHasAlreadyBeenRecorded : 1;
			unsigned int bUpdateMatricesRequired : 1;
			unsigned int bFleeWhenStanding : 1; //

			unsigned int bMiamiViceCop : 1;  //
			unsigned int bMoneyHasBeenGivenByScript : 1; //
			unsigned int bHasBeenPhotographed : 1;  //
			unsigned int bIsDrowning : 1;
			unsigned int bDrownsInWater : 1;
			unsigned int bHeadStuckInCollision : 1;
			unsigned int bDeadPedInFrontOfCar : 1;
			unsigned int bStayInCarOnJack : 1;

			unsigned int bDontFight : 1;
			unsigned int bDoomAim : 1;
			unsigned int bCanBeShotInVehicle : 1;
			unsigned int bPushedAlongByCar : 1;
			unsigned int bNeverEverTargetThisPed : 1;
			unsigned int bThisPedIsATargetPriority : 1;
			unsigned int bCrouchWhenScared : 1;
			unsigned int bKnockedOffBike : 1;

			unsigned int bDonePositionOutOfCollision : 1;
			unsigned int bDontRender : 1;
			unsigned int bHasBeenAddedToPopulation : 1;
			unsigned int bHasJustLeftCar : 1;
			unsigned int bIsInDisguise : 1;
			unsigned int bDoesntListenToPlayerGroupCommands : 1;
			unsigned int bIsBeingArrested : 1;
			unsigned int bHasJustSoughtCover : 1;

			unsigned int bKilledByStealth : 1;
			unsigned int bDoesntDropWeaponsWhenDead : 1;
			unsigned int bCalledPreRender : 1;
			unsigned int bBloodPuddleCreated : 1;
			unsigned int bPartOfAttackWave : 1;
			unsigned int bClearRadarBlipOnDeath : 1;
			unsigned int bNeverLeavesGroup : 1;
			unsigned int bTestForBlockedPositions : 1;

			unsigned int bRightArmBlocked : 1;
			unsigned int bLeftArmBlocked : 1;
			unsigned int bDuckRightArmBlocked : 1;
			unsigned int bMidriffBlockedForJump : 1;
			unsigned int bFallenDown : 1;
			unsigned int bUseAttractorInstantly : 1;
			unsigned int bDontAcceptIKLookAts : 1;
			unsigned int bHasAScriptBrain : 1;

			unsigned int bWaitingForScriptBrainToLoad : 1;
			unsigned int bHasGroupDriveTask : 1;
			unsigned int bCanExitCar : 1;
			unsigned int CantBeKnockedOffBike : 2;
			unsigned int bHasBeenRendered : 1;
			unsigned int bIsCached : 1;
			unsigned int bPushOtherPeds : 1;

			unsigned int bHasBulletProofVest : 1;
			unsigned int bUsingMobilePhone : 1;
			unsigned int bUpperBodyDamageAnimsOnly : 1;
			unsigned int bStuckUnderCar : 1;
			unsigned int bKeepTasksAfterCleanUp : 1;
			unsigned int bIsDyingStuck : 1;
			unsigned int bIgnoreHeightCheckOnGotoPointTask : 1;
			unsigned int bForceDieInCar : 1;

			unsigned int bCheckColAboveHead : 1;
			unsigned int bIgnoreWeaponRange : 1;
			unsigned int bDruggedUp : 1;
			unsigned int bWantedByPolice : 1;
			unsigned int bSignalAfterKill : 1;
			unsigned int bCanClimbOntoBoat : 1;
			unsigned int bPedHitWallLastFrame : 1;
			unsigned int bIgnoreHeightDifferenceFollowingNodes : 1;

			unsigned int bMoveAnimSpeedHasBeenSetByTask : 1;
			unsigned int bGetOutUpsideDownCar : 1;
			unsigned int bJustGotOffTrain : 1;
			unsigned int bDeathPickupsPersist : 1;
			unsigned int bTestForShotInVehicle : 1;
			unsigned int bUsedForReplay : 1;
		} nPedFlags;
		CPedIntelligence   *pIntelligence;
		CPlayerData        *pPlayerData;
		unsigned int        nCreatedBy;
		AnimBlendFrameData *apBones[19];
		unsigned int        nAnimGroup;
		vector2d           vecAnimMovingShiftLocal;
		CPedAcquaintance    acquaintance;
		RwObject           *pWeaponObject;
		RwFrame            *pGunflashObject;
		RwObject           *pGogglesObject;
		unsigned char      *pGogglesState;
		short               nWeaponGunflashAlphaMP1;
		short field_506;
		short               nWeaponGunflashAlphaMP2;
		short field_50A;
		CPedIK              pedIK;
		int field_52C;
		ePedState           nPedState;
		int                 nMoveState;
		int field_538;
		int field_53C;
		float               fHealth;
		float               fMaxHealth;
		float               fArmour;
		int field_54C;
		vector2d           		vecAnimMovingShift;
		float               fCurrentRotation;
		float               fAimingRotation;
		float               fHeadingChangeRate;
		int field_564;
		int field_568;
		vector3d field_56C;
		vector3d field_578;
		CEntity            *pContactEntity;
		float field_588;
		CVehicle           *pVehicle;
		int field_590;
		int field_594;
		int                 nPedType;
		void               *pStats;
		CWeapon             aWeapons[13];
		eWeaponType         nSavedWeapon;
		eWeaponType         nDelayedWeapon;
		unsigned int        nDelayedWeaponAmmo;
		unsigned char       nActiveWeaponSlot;
		unsigned char       nWeaponShootingRate;
		unsigned char       nWeaponAccuracy;
		CObject            *pTargetedObject;
		int field_720;
		int field_724;
		int field_728;
		char                nWeaponSkill;
		char                nFightingStyle;
		char                nAllowedAttackMoves;
		char field_72F;
		CFire              *pFire;
		int field_734;
		int field_738;
		int field_73C;
		int                 nWeaponModelId;
		int field_744;
		int field_748;
		int field_74C;
		int                 nDeathTime;
		char                nBodypartToRemove;
		char field_755;
		short               nMoneyCount;
		int field_758;
		int field_75C;
		char                nLastWeaponDamage;
		CEntity            *pLastEntityDamage;
		int field_768;
		vector3d             	vecTurretOffset;
		float               fTurretAngleA;
		float               fTurretAngleB;
		int                 nTurretPosnMode;
		int                 nTurretAmmo;
		void               *pCoverPoint;
		void               *pEnex;
		float               fRemovalDistMultiplier;
		short               nSpecialModelIndex;
		char field_796[2];
		int field_798;
	} CPed;
]]

shared.validate_size('CPed', 0x79C)