byteCurrentWeapon offsets (0.3.7)

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Hi, is anyone successfully getting correct weapon id by just accessing the structure from mod_sa V4.4.0.1 source? I was getting 0 value (both, on foot + in car) using it. I found out that for some reason on my version onFootWepId is located at stRemotePlayerData+236 and inCarWepID is at stRemotePlayerData+322

Code:
struct stOnFootData
{
	uint16_t	sLeftRightKeys;//0
	uint16_t	sUpDownKeys;//2
	union//4
	{
		uint16_t			sKeys;
		struct stSAMPKeys	stSampKeys;
	};
	float		fPosition[3];//6
	float		fQuaternion[4];//18
	uint8_t		byteHealth;//34
	uint8_t		byteArmor;//35
	uint8_t		byteCurrentWeapon;//36
	uint8_t		byteSpecialAction;//
	float		fMoveSpeed[3];
	float		fSurfingOffsets[3];
	uint16_t	sSurfingVehicleID;
	short		sCurrentAnimationID;
	short		sAnimFlags;
};

struct stInCarData
{
	uint16_t	sVehicleID;//0
	uint16_t	sLeftRightKeys;//2
	uint16_t	sUpDownKeys;//4
	union//6
	{
		uint16_t			sKeys;
		struct stSAMPKeys	stSampKeys;
	};//8
	float		fQuaternion[4];//10
	float		fPosition[3];//26
	float		fMoveSpeed[3];//38
	float		fVehicleHealth;//50
	uint8_t		bytePlayerHealth;//54
	uint8_t		byteArmor;//55
	uint8_t		byteCurrentWeapon;//56
	uint8_t		byteSiren;//
	uint8_t		byteLandingGearState;
	uint16_t	sTrailerID;
	union
	{
		uint16_t	HydraThrustAngle[2];	//nearly same value
		float		fTrainSpeed;
	};
};



struct stRemotePlayerData
{
	struct stSAMPPed		*pSAMP_Actor; //0
	struct stSAMPVehicle	*pSAMP_Vehicle;//4
	uint8_t					byteTeamID;//8
	uint8_t					bytePlayerState;//9
	uint8_t					byteSeatID;//10
	uint32_t				ulUnk3;//11
	int						iPassengerDriveBy;//15
	void					*pUnk0;//19
	uint8_t					byteUnk1[60];//23
	float					fSomething[3];//83  
	float					fVehicleRoll[4];//95
	uint32_t				ulUnk2[3];//111
	float					fOnFootPos[3];//123
	float					fOnFootMoveSpeed[3];//135
	float					fVehiclePosition[3];//147
	float					fVehicleMoveSpeed[3];//159
	uint16_t				sPlayerID;//171
	uint16_t				sVehicleID;//173
	uint32_t				ulUnk5;//175
	uint8_t					byteUnk6[2];//179
	short					sShowNameTag;//181
	int						iHasJetPack;//183??
	uint8_t					byteSpecialAction;//187
	struct stAimData		aimData;//188
	struct stInCarData		inCarData;//219
	struct stOnFootData		onFootData;//282
	struct stTrailerData	trailerData;//350
	struct stPassengerData	passengerData;//404
	uint32_t				ulUnk4[3];//428
	float					fActorArmor;//440
	float					fActorHealth;//444
	uint32_t				ulUnk10;//448
	uint8_t					byteUnk9;//452
	uint32_t				dwTick;//453
	uint32_t				dwLastStreamedInTick;//457	// is 0 when currently streamed in
	uint32_t				ulUnk7;//561
	int						iAFKState;//565
	struct stHeadSync		headSyncData;//569
	//float1 - offset 569
	//float2 - 573
	//float3 - 577
	int						iGlobalMarkerLoaded;//589
	int						iGlobalMarkerLocation[3];//593
	uint32_t				ulGlobalMarker_GTAID;//605
};
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
Offsets are good, the remotePlayerData struct you use is wrong.
See https://github.com/BlastHackNet/mod_s0beit_sa/blob/master/src/samp.h#L580 for correct stRemotePlayerData.
 
Top