C++ Paused Player

Prefixobjekt

Active member
Joined
Aug 1, 2014
Messages
55
Reaction score
0
Hey

a Little question:
Can i check by the PED, if a Player´s game is paused = ESC?

thanx-
 

uwe1337

Active member
Joined
Feb 4, 2014
Messages
36
Reaction score
0
Yeah why not?
look in Sobeit Source or something ...
Code:
if ( g_Players->pRemotePlayer[iSAMPID]->pPlayerData->iAFKState == 2 )
{
     _snprintf_s( statebuf, sizeof(statebuf)-1, "AFK");
     //......
}
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
No, you can't. Only from the samp player structure(see above).
 

Prefixobjekt

Active member
Joined
Aug 1, 2014
Messages
55
Reaction score
0
can anyone tell me how to generate this Offsets like

HP pRemoteplayerData + 444
Armor pRemoteplayerData + 440

?
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Hi, from my calculations using the sobeit source (0.3.7) the offsets are 220 for armor and 224 for hp, I might be wrong though because I didn't test it.

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;//192
struct stOnFootData onFootData;//196
struct stTrailerData trailerData;//200
struct stPassengerData passengerData;//204
uint32_t ulUnk4[3];//208
float fActorArmor;//220
float fActorHealth;//224
uint32_t ulUnk10;//228
uint8_t byteUnk9;//232
uint32_t dwTick;//233
uint32_t dwLastStreamedInTick;//237 // is 0 when currently streamed in
uint32_t ulUnk7;//241
int iAFKState;//245
struct stHeadSync headSyncData;//249
int iGlobalMarkerLoaded;//253
int iGlobalMarkerLocation[3];//257
uint32_t ulGlobalMarker_GTAID;//261
};

Here's an example code to get the ID, score and position for all players. You could modify it by deleting few things and adding something like:
float armor = *(float*)(*pRemotePlayerData + 220);
float hp = *(float*)(*pRemotePlayerData + 224);

It's kinda noobish because it makes a window displaying info instead of drawing someting in game, I have no idea how to do it properly to be honest

Code:
DWORD SampDLL = (DWORD)GetModuleHandleA("samp.dll");
if(SampDLL)
{
	for(;;)
	{
		pInfo = (DWORD*)(SampDLL+SAMP_INFO);
		pPools = (DWORD*)(*pInfo + SAMP_POOLS);
		pPlayerPool = (DWORD*)(*pPools + 24);
		pRemotePlayer = (DWORD*)(*pPlayerPool + 46);
		pRemotePlayerData = (DWORD*)(*pRemotePlayer + 0);
		
		for(DWORD i = 0; i < 4016; i += 4)
		{
			iIsListed = *(DWORD*)(*pPlayerPool + 4062 + i);
			if(iIsListed > 0x00)
			{
				Sleep(2);

				//i is the offset of the active/listed player
				pRemotePlayer = (DWORD*)(*pPlayerPool + 46 + i);
				pRemotePlayerData = (DWORD*)(*pRemotePlayer + 0);
				short id = *(short*)(*pRemotePlayerData + 171); //sPlayerID;//171
				float x = *(float*)(*pRemotePlayerData + 123);  //fOnFootPos[3];//123
				float y = *(float*)(*pRemotePlayerData + 127);
				float z = *(float*)(*pRemotePlayerData + 131);
				int score = *(int*)(*pRemotePlayer + 36);

				char buff[100];
				sprintf_s(buff, "id: %d   score: %d   x:%f y:%f z:%f", id, score, x,y,z);
				MessageBoxA(0, buff, "SAMP message", 0);
				Sleep(300);			
			}
		}
		Sleep(3000);
	}
}
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
Prefixobjekt link said:
can anyone tell me how to generate this Offsets like

HP pRemoteplayerData + 444
Armor pRemoteplayerData + 440

?

http://www.cplusplus.com/reference/cstddef/offsetof/
ie; offsetof(stRemotePlayerData, fActorHealth)

or you can just substract base adress - member address

monday link said:
Hi, from my calculations using the sobeit source (0.3.7) the offsets are 220 for armor and 224 for hp, I might be wrong though because I didn't test it.

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;//192
struct stOnFootData onFootData;//196
struct stTrailerData trailerData;//200
struct stPassengerData passengerData;//204
uint32_t ulUnk4[3];//208
float fActorArmor;//220
float fActorHealth;//224
uint32_t ulUnk10;//228
uint8_t byteUnk9;//232
uint32_t dwTick;//233
uint32_t dwLastStreamedInTick;//237 // is 0 when currently streamed in
uint32_t ulUnk7;//241
int iAFKState;//245
struct stHeadSync headSyncData;//249
int iGlobalMarkerLoaded;//253
int iGlobalMarkerLocation[3];//257
uint32_t ulGlobalMarker_GTAID;//261
};

You misscalculated structures size, they aren't pointers, they're whole structures that range in size.

Code:
struct stAimData 
{
	BYTE	byteCamMode; //0
	float	vecAimf1[3]; //1
	float	vecAimPos[3]; //13
	float	fAimZ; //25
	BYTE	byteCamExtZoom : 6; //29		
	BYTE	byteWeaponState : 2; //30
	BYTE	bUnk; //31 
};
so stAimData size is 31

uint8_t 		 byteSpecialAction; //187
uint32_t 		ulUnk4[3]; //188
struct 		stOnFootData onFootData; //200 (size 68)
struct 		stInCarData inCarData; //268 (size 63) 
struct 		stTrailerData trailerData; //331 (size 54)
struct 		stPassengerData passengerData; //385 (size 24)
struct 		stAimData aimData; //409 (size 31) 
float 			fActorArmor; //440 
float			 fActorHealth; //444
 
Top