Ped Pool

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
hey,

i wanna read the ped pool with c++..
i already have the sample code for cleo but i dont know how i can translate it
i hope someone can help me..
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
Access it like this :
Code:
#define cPedpPoolStart 0xB7CD98
#define cPedpLocalPlayer 0xB6F5F0
#define cPedPoolMaximumNumber 0xB74498
#define OFFSET_HEALTH 0x540
#define OFFSET_MATRIX 0x14
#define OFFSET_POS_X 0x30
#define OFFSET_POS_Y 0x34
#define OFFSET_POS_Z 0x38

// EXAMPLE: set cPed [ID = 2]'s health to 0

*(float*)(*(DWORD*)(cPedpPoolStart + 2*4) + OFFSET_HEALTH) = 0;
Example functions :
change cped health...

Code:
void SetPlayerhealth(unsigned short cPedPoolID, float health)
{
*(float*)(*(DWORD*)(cPedpPoolStart + cPedPoolID*4) + OFFSET_HEALTH) = health;
}
teleport all peds to you..

Code:
void TeleportALLPedsToMe(unsigned short cPedPoolID)
{
DWORD myCped = *(DWORD*)cPedpLocalPlayer;
DWORD myMatrix = *(DWORD*)(myCped + 0x14);

float MyPosition[3];
MyPosition[0] = *(float*)(myMatrix + OFFSET_POS_X)
MyPosition[1] = *(float*)(myMatrix + OFFSET_POS_Y)
MyPosition[2] = *(float*)(myMatrix + OFFSET_POS_Z)

for (int i = 0; i < *(int*)cPedPoolMaximumNumber ; i++)
{
  if(*(DWORD*)(cPedpPoolStart + i * 0x4) == NULL)
  {
        return;
  }  
 
 *(float*)( (*(DWORD*)(*(DWORD*)(cPedpPoolStart  + i * 0x4) + 0x14) + OFFSET_POS_X) = MyPosition[0]
 *(float*)( (*(DWORD*)(*(DWORD*)(cPedpPoolStart  + i * 0x4) + 0x14) + OFFSET_POS_Y) = MyPosition[1]
 *(float*)( (*(DWORD*)(*(DWORD*)(cPedpPoolStart  + i * 0x4) + 0x14) + OFFSET_POS_Z) = MyPosition[2]
}
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
thx, but it does not work
i have tried your code and called a function.. im getting a crash (tested in mp&sp)
i think an address is wrong?
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
that's the code from my old gta sa trainer, i used that to teleport pedestrians and throw them from an airplane lol... i'm pretty sure it works...
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
:bawww:
i used your example
Code:
void SetPlayerhealth(unsigned short cPedPoolID, float health)
{
	*(float*)(*(DWORD*)(cPedpPoolStart + cPedPoolID * 4) + OFFSET_HEALTH) = health;
}
and called it like this
Code:
for (int i = 0; i < 200; i++)
				SetPlayerhealth(i, 0);
all peds must die but it dont work
after I die the game has crashed
the game crash also when i call the function
Code:
SetPlayerhealth(2, 0);
idk.. whats the problem
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
push push

help please
i dont understand the structure
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Try this code modified from T3K's example:

Code:
#define cPedpPoolStart 0xB7CD98                      //Leave out if already defined
#define cPedPoolMaximumNumber 0xB74498      //
#define OFFSET_HEALTH 0x540                         //

for (int i = 0; i < *(int*)cPedPoolMaximumNumber ; i++)
{

  if(*(DWORD*)(cPedpPoolStart + i * 0x4) == NULL)
  {
        return;
  }  
 
 SetPlayerhealth(i, 0.0);

}
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
mrT101 link said:
post all of the code here from your .cpp

you are creating an asi, yes?
yes

Code:
Includes and defines here


void InitHack(void);
DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	switch (dwReason)
	{
	case DLL_PROCESS_ATTACH:
		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)InitHack, 0, 0, 0);
		break;
	}
	return 1;
}

void SetPlayerhealth(unsigned short cPedPoolID, float health)
{
	*(float*)(*(DWORD*)(cPedpPoolStart + cPedPoolID * 4) + OFFSET_HEALTH) = health;
}

void InitHack(void)
{
while (1)
	{
		for (int i = 1; i < *(int*)cPedPoolMaximumNumber; i++)
	        {

		      if (*(DWORD*)(cPedpPoolStart + i * 0x4) == NULL)
		      {
			    return;
		      }
		      SetPlayerhealth(i, 0.0);
	        }
		Sleep(1);
	}
}
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Try This. As far as I know, playerIds start at 0 so in your for loop, start with i at a value of 0.
I've made it so that you have to press the numpad9 key to set the player health. The crash may have been caused as you were trying to set ped health to 0 as soon as the game launched so now press numpad9 once you are ingame and see if it works.

Code:
Includes and defines here


void InitHack();

DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	switch (dwReason)
	{
	case DLL_PROCESS_ATTACH:
		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)InitHack, 0, 0, 0);
		break;
	}
	return 1;
}

void SetPlayerhealth(unsigned short cPedPoolID, float health)
{
	*(float*)(*(DWORD*)(cPedpPoolStart + cPedPoolID * 4) + OFFSET_HEALTH) = health;
}


void InitHack()
{
while (1)
	{
		
             if(GetAsyncKeyState(VK_NUMPAD9))  //check for keypress numpad9
             {
                for (int i = 0; i < *(int*)cPedPoolMaximumNumber; i++)
	        {

		      if (*(DWORD*)(cPedpPoolStart + i * 0x4) == NULL){}

		      else{ SetPlayerhealth(i, 0.0);}

	        }
                Sleep(200);
             }
             Sleep(10);
	}
}
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
:me_gusta:
i pressed numpad9 and i died
after that the game crashs
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
1ecc36e745.png

here the function(PedPool) + debug info...

the position is always the same
[member=5679]T3K[/member]
[member=10256]mrT101[/member]
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
1337 link said:
1ecc36e745.png

here the function(PedPool) + debug info...

the position is always the same
[member=5679]T3K[/member]
[member=10256]mrT101[/member]
wait, maybe my code is wrong...
 

1337

Member
Joined
Mar 27, 2013
Messages
19
Reaction score
0
its possible :D

how you got cPedPoolMaximumNumber ?
 
Top