PED* GET_PED_POINTER(Ped ped)
{
POOL *pool = *(POOL**)(PED_POOL_ADDRESS);
return (PED*)(pool->FirstPointer + ((ped / 0x100) * pool->StructSize));
}
#define PED_POOL_ADDRESS 0x100ACBC
#define VEHICLE_POOL_ADDRESS 0x15C26D0
typedef struct
{
int FirstPointer;
int BoolAddress;
int MaxHandle;
int StructSize;
int unk1;
int HandlesInPool;
}POOL;
//kick
int kick = (int)getGlobalPtrAtIndex(18) + 0x29C;
*(int*)(kick) = (*(int*)(kick) == i) ? -1 : i;
//suggest
uint random;
GENERATE_RANDOM_INT_IN_RANGE(0, 14, &random);
int add = (int)getGlobalPtrAtIndex(18);
*(int*)(add + 0x294) = random;
//attach ped to player undetected
Ped AttachPed = SpawnPed(MODEL_M_M_CRACKHEAD, x, y, z);
int NetPedPtr = (int)GET_PED_POINTER(NetPed);
int AttachPedptr = (int)GET_PED_POINTER(AttachPed);
*(int*)(AttachPedptr + 0x1E0) = 0x00000305;
*(int*)(AttachPedptr + 0x1BC) = NetPedPtr;
//sync freeze
float x, y, z;
GET_CHAR_COORDINATES(NetPed, &x, &y, &z);
int address = *(int*)(GET_PED_POINTER(pPed) + 0x64);
int tmp = *(int*)(address + 0x10);
*(int*)(address + 0x10) = 0;
TELEPORT_NETWORK_PLAYER(GET_PLAYER_ID(), x, y, z);
WAIT(100);
*(int*)(address + 0x10) = tmp;
//sprx send damage event
opd_s DamagePlayer_t = { 0x7F8050, 0xF6CCE8 };
int(*DamagePlayer)(int a1, int MyPedPtr, int VictimPedPtr, int* Pos, int a5, int Headshot, int a7, int Weapon, int a9) = (int(*)(int, int, int, int*, int, int, int, int, int))&DamagePlayer_t;
void DAMAGE_EVENT(Native_s *Native)
{
DamagePlayer(0x1737FAC, *(int*)(Native->dwParamAddr), *(int*)(Native->dwParamAddr + 0x4), *(int**)(Native->dwParamAddr + 0x8), 0xC, 1, 0, 0x10, 0);
}
//How to use
PED *MyPtr = GET_PED_POINTER(pPed);
PED *VictimPtr = GET_PED_POINTER(NetPed);
vector3 Pos;
GET_PED_BONE_POSITION(NetPed, BONE_HEAD, 0, 0, 0, &Pos);
DAMAGE_EVENT((int)MyPtr, (int)VictimPtr, (int*)&Pos);
//sprx send ragdoll event
opd_s Ragdoll_t = { 0x7F7C50, 0xF6CCE8 };
int(*Ragdoll)(int, int NetID) = (int(*)(int, int))&Ragdoll_t;
void RAGDOLL_PLAYER(Native_s *Native)
{
Ragdoll(0x1737FAC, *(int*)(Native->dwParamAddr));
}
//How to use
int NetID;
GET_NETWORK_ID_FROM_PED(NetPed, &NetID);
RAGDOLL_PLAYER(NetID);
//Get handle of the ped you're free aiming at
Ped GET_HANDLE_FROM_TARGETTED_PED()
{
Ped ped;
GET_PLAYER_CHAR(GET_PLAYER_ID(), &ped);
PED *PedPtr = GET_PED_POINTER(ped);
int address = *(int*)(PedPtr + 0x21C);
address = *(int*)(address + 0x54);
address = *(int*)(address + 0x8);
if (address)
{
POOL* PedPool = *(POOL**)(PED_POOL_ADDRESS);
address = *(int*)(address + 0x30);
if (address >= PedPool->FirstPointer && address <= PedPool->FirstPointer + (PedPool->StructSize * PedPool->MaxHandle))
return GET_HANDLE_FROM_PED_POOL((PED*)address);
}
return 0;
}
Ped GET_HANDLE_FROM_PED_POOL(PED *Pointer_Address)
{
POOL *pedpool = *(POOL**)(PED_POOL_ADDRESS);
return GET_HANDLE_FROM_POOL(pedpool, (int)Pointer_Address);
}
int GET_HANDLE_FROM_POOL(POOL* pool, int Pointer_Address)
{
const int Index = (Pointer_Address - pool->FirstPointer) / pool->StructSize;
return (Index * 0x100) + *(byte*)(pool->BoolAddress + Index);
}
//Vehicle velocity limit (requires you to spawn car again after changing value)
int address = *(int*)(0x15C2A28);
if (address)
{
address = *(int*)(address + 0x38);
address = *(int*)(address + 0x9C);
address = *(int*)(address + 0x4);
*(float*)(address + 0x28) = FloatValue;
}
//Color palette
typedef struct
{
int Colours[134];
}VEHICLE_COLOURS;
float Colour_X = 0.0666458f;
float Colour_Y = 0.325f;
VEHICLE_COLOURS* Colours = (VEHICLE_COLOURS*)(0x1164128);
for (int i = 1; i < 134; i++)
{
if (bits->Vehicle.PaletteIndex == i)
DRAW_RECT(Colour_X, Colour_Y, 0.03025f, 0.03025f, 255, 255, 255, 255);
int address = (int)&Colours->Colours;
DRAW_RECT(Colour_X, Colour_Y, 0.025f, 0.025f, *(byte*)(address + 1), *(byte*)(address + 2), *(byte*)(address + 3), 255);
Colour_X += 0.028125f;
if (i % 7 == 0){
Colour_X = 0.0666458f;
Colour_Y += 0.028125f;
}
}
if (IS_BUTTON_JUST_PRESSED(0, BUTTON_X))
{
vehicle = GetPlayerVehicle();
if (vehicle != -1)
{
int Colour_1;
int Colour_2;
GET_CAR_COLOURS(vehicle, &Colour_1, &Colour_2);
CHANGE_CAR_COLOUR(vehicle, bits->Vehicle.PaletteIndex, Colour_2);
}
}
//Grab cars like in singleplayer
if (IS_BUTTON_PRESSED(0, BUTTON_L1))
{
Ped MyPed = pPed;
PED* PedPtr = GET_PED_POINTER(MyPed);
if (PedPtr->NumOfTouchedEntities)
{
VEHICLE* VehPtr = (VEHICLE*)(PedPtr->TouchedEntityPtr); //TouchedEntityPtr offset 0x150
POOL* Pool = GET_VEHICLE_POOL_ADDRESS();
int MaxSize = (int)(Pool->FirstPointer) + ((Pool->MaxHandle - 1) * Pool->StructSize);
int FirstPtr = (int)(Pool->FirstPointer);
bool BelongsToVehiclePool = (int)(VehPtr) >= FirstPtr && (int)(VehPtr) <= MaxSize;
if (VehPtr && BelongsToVehiclePool)
{
int Type = VehPtr->Type; //Type offset 0x12E4
if (Type >= 0 && Type <= 4)
{
Vehicle Handle = GET_HANDLE_FROM_POOL(Pool, (int)VehPtr);
if (Handle)
{
UNLOCK_RAGDOLL(MyPed, 1);
SWITCH_PED_TO_RAGDOLL(MyPed, 50000, 9999000, 1, 1, 1, 0);
CREATE_NM_MESSAGE(1, 161);
SET_NM_MESSAGE_INSTANCE_INDEX(177, 0, Handle, 0);
SET_NM_MESSAGE_VEC3(165, -1.0f, 1.0f, 0.5f);
SET_NM_MESSAGE_VEC3(166, -1.0f, 0.0f, 0.5f);
SET_NM_MESSAGE_VEC3(167, 0.0f, 1.0f, 0.5f);
SET_NM_MESSAGE_VEC3(168, 0.0f, 0.0f, 0.5f);
SET_NM_MESSAGE_BOOL(175, 1);
SET_NM_MESSAGE_BOOL(176, 1);
SET_NM_MESSAGE_BOOL(172, 1);
SET_NM_MESSAGE_BOOL(178, 1);
SET_NM_MESSAGE_FLOAT(164, -1.00000000);
SEND_NM_MESSAGE(MyPed);
}
}
}
}
}
if (IS_BUTTON_JUST_PRESSED(0, BUTTON_L2))
{
if (IS_PED_RAGDOLL(pPed))
{
UNLOCK_RAGDOLL(pPed, 0);
}
}
POOL *GET_VEHICLE_POOL_ADDRESS()
{
return *(POOL**)(VEHICLE_POOL_ADDRESS);
}
//Spectate cam like in gta race
Camera cam;
GET_GAME_CAM(&cam);
if (bits->Spectate)
{
SET_CAM_TARGET_PED(cam, pPed);
SET_IN_SPECTATOR_MODE(0);
SET_CAM_BEHIND_PED(pPed);
CAM_RESTORE();
SET_PLAYER_CONTROL(iPlayer, true);
SET_CHAR_VISIBLE(pPed, true);
DETACH_PED(pPed, true);
SET_CHAR_COLLISION(pPed, 1);
TELEPORT_NETWORK_PLAYER(iPlayer, 2635.00, 415, 79.00);
ToggleBool(bits->Spectate);
return;
}
if (IS_HOLY_GHOST(NetPlayerID)) return;
SET_PLAYER_CONTROL(iPlayer, false);
if (!IS_IN_SPECTATOR_MODE())
{
SET_IN_SPECTATOR_MODE(1);
}
SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS(0);
SET_CINEMATIC_BUTTON_ENABLED(0);
ACTIVATE_SCRIPTED_CAMS(0, 0);
SET_CAM_TARGET_PED(cam, NetPed);
SET_CHAR_COLLISION(pPed, 0);
SET_CHAR_VISIBLE(pPed, 0);
ToggleBool(bits->Spectate);
//rejoin freemode lobby or restart lobby if you're real host, cant remember parameters, figure them out yourself
extern _native bool NETWORK_CHANGE_GAME_MODE_E1(int a1, int a2, int a3, int MaxTeamCount, int a5, int a6, int a7, int a8)l
if (IS_NETWORK_SESSION() && !IS_THIS_MACHINE_THE_SERVER())
{
*(byte*)(FAKE_HOST) = 1;
NETWORK_CHANGE_GAME_MODE_E1(16, 16, 16, 0, 1, 0, 1, 0);
}
{
POOL *pool = *(POOL**)(PED_POOL_ADDRESS);
return (PED*)(pool->FirstPointer + ((ped / 0x100) * pool->StructSize));
}
#define PED_POOL_ADDRESS 0x100ACBC
#define VEHICLE_POOL_ADDRESS 0x15C26D0
typedef struct
{
int FirstPointer;
int BoolAddress;
int MaxHandle;
int StructSize;
int unk1;
int HandlesInPool;
}POOL;
//kick
int kick = (int)getGlobalPtrAtIndex(18) + 0x29C;
*(int*)(kick) = (*(int*)(kick) == i) ? -1 : i;
//suggest
uint random;
GENERATE_RANDOM_INT_IN_RANGE(0, 14, &random);
int add = (int)getGlobalPtrAtIndex(18);
*(int*)(add + 0x294) = random;
//attach ped to player undetected
Ped AttachPed = SpawnPed(MODEL_M_M_CRACKHEAD, x, y, z);
int NetPedPtr = (int)GET_PED_POINTER(NetPed);
int AttachPedptr = (int)GET_PED_POINTER(AttachPed);
*(int*)(AttachPedptr + 0x1E0) = 0x00000305;
*(int*)(AttachPedptr + 0x1BC) = NetPedPtr;
//sync freeze
float x, y, z;
GET_CHAR_COORDINATES(NetPed, &x, &y, &z);
int address = *(int*)(GET_PED_POINTER(pPed) + 0x64);
int tmp = *(int*)(address + 0x10);
*(int*)(address + 0x10) = 0;
TELEPORT_NETWORK_PLAYER(GET_PLAYER_ID(), x, y, z);
WAIT(100);
*(int*)(address + 0x10) = tmp;
//sprx send damage event
opd_s DamagePlayer_t = { 0x7F8050, 0xF6CCE8 };
int(*DamagePlayer)(int a1, int MyPedPtr, int VictimPedPtr, int* Pos, int a5, int Headshot, int a7, int Weapon, int a9) = (int(*)(int, int, int, int*, int, int, int, int, int))&DamagePlayer_t;
void DAMAGE_EVENT(Native_s *Native)
{
DamagePlayer(0x1737FAC, *(int*)(Native->dwParamAddr), *(int*)(Native->dwParamAddr + 0x4), *(int**)(Native->dwParamAddr + 0x8), 0xC, 1, 0, 0x10, 0);
}
//How to use
PED *MyPtr = GET_PED_POINTER(pPed);
PED *VictimPtr = GET_PED_POINTER(NetPed);
vector3 Pos;
GET_PED_BONE_POSITION(NetPed, BONE_HEAD, 0, 0, 0, &Pos);
DAMAGE_EVENT((int)MyPtr, (int)VictimPtr, (int*)&Pos);
//sprx send ragdoll event
opd_s Ragdoll_t = { 0x7F7C50, 0xF6CCE8 };
int(*Ragdoll)(int, int NetID) = (int(*)(int, int))&Ragdoll_t;
void RAGDOLL_PLAYER(Native_s *Native)
{
Ragdoll(0x1737FAC, *(int*)(Native->dwParamAddr));
}
//How to use
int NetID;
GET_NETWORK_ID_FROM_PED(NetPed, &NetID);
RAGDOLL_PLAYER(NetID);
//Get handle of the ped you're free aiming at
Ped GET_HANDLE_FROM_TARGETTED_PED()
{
Ped ped;
GET_PLAYER_CHAR(GET_PLAYER_ID(), &ped);
PED *PedPtr = GET_PED_POINTER(ped);
int address = *(int*)(PedPtr + 0x21C);
address = *(int*)(address + 0x54);
address = *(int*)(address + 0x8);
if (address)
{
POOL* PedPool = *(POOL**)(PED_POOL_ADDRESS);
address = *(int*)(address + 0x30);
if (address >= PedPool->FirstPointer && address <= PedPool->FirstPointer + (PedPool->StructSize * PedPool->MaxHandle))
return GET_HANDLE_FROM_PED_POOL((PED*)address);
}
return 0;
}
Ped GET_HANDLE_FROM_PED_POOL(PED *Pointer_Address)
{
POOL *pedpool = *(POOL**)(PED_POOL_ADDRESS);
return GET_HANDLE_FROM_POOL(pedpool, (int)Pointer_Address);
}
int GET_HANDLE_FROM_POOL(POOL* pool, int Pointer_Address)
{
const int Index = (Pointer_Address - pool->FirstPointer) / pool->StructSize;
return (Index * 0x100) + *(byte*)(pool->BoolAddress + Index);
}
//Vehicle velocity limit (requires you to spawn car again after changing value)
int address = *(int*)(0x15C2A28);
if (address)
{
address = *(int*)(address + 0x38);
address = *(int*)(address + 0x9C);
address = *(int*)(address + 0x4);
*(float*)(address + 0x28) = FloatValue;
}
//Color palette
typedef struct
{
int Colours[134];
}VEHICLE_COLOURS;
float Colour_X = 0.0666458f;
float Colour_Y = 0.325f;
VEHICLE_COLOURS* Colours = (VEHICLE_COLOURS*)(0x1164128);
for (int i = 1; i < 134; i++)
{
if (bits->Vehicle.PaletteIndex == i)
DRAW_RECT(Colour_X, Colour_Y, 0.03025f, 0.03025f, 255, 255, 255, 255);
int address = (int)&Colours->Colours;
DRAW_RECT(Colour_X, Colour_Y, 0.025f, 0.025f, *(byte*)(address + 1), *(byte*)(address + 2), *(byte*)(address + 3), 255);
Colour_X += 0.028125f;
if (i % 7 == 0){
Colour_X = 0.0666458f;
Colour_Y += 0.028125f;
}
}
if (IS_BUTTON_JUST_PRESSED(0, BUTTON_X))
{
vehicle = GetPlayerVehicle();
if (vehicle != -1)
{
int Colour_1;
int Colour_2;
GET_CAR_COLOURS(vehicle, &Colour_1, &Colour_2);
CHANGE_CAR_COLOUR(vehicle, bits->Vehicle.PaletteIndex, Colour_2);
}
}
//Grab cars like in singleplayer
if (IS_BUTTON_PRESSED(0, BUTTON_L1))
{
Ped MyPed = pPed;
PED* PedPtr = GET_PED_POINTER(MyPed);
if (PedPtr->NumOfTouchedEntities)
{
VEHICLE* VehPtr = (VEHICLE*)(PedPtr->TouchedEntityPtr); //TouchedEntityPtr offset 0x150
POOL* Pool = GET_VEHICLE_POOL_ADDRESS();
int MaxSize = (int)(Pool->FirstPointer) + ((Pool->MaxHandle - 1) * Pool->StructSize);
int FirstPtr = (int)(Pool->FirstPointer);
bool BelongsToVehiclePool = (int)(VehPtr) >= FirstPtr && (int)(VehPtr) <= MaxSize;
if (VehPtr && BelongsToVehiclePool)
{
int Type = VehPtr->Type; //Type offset 0x12E4
if (Type >= 0 && Type <= 4)
{
Vehicle Handle = GET_HANDLE_FROM_POOL(Pool, (int)VehPtr);
if (Handle)
{
UNLOCK_RAGDOLL(MyPed, 1);
SWITCH_PED_TO_RAGDOLL(MyPed, 50000, 9999000, 1, 1, 1, 0);
CREATE_NM_MESSAGE(1, 161);
SET_NM_MESSAGE_INSTANCE_INDEX(177, 0, Handle, 0);
SET_NM_MESSAGE_VEC3(165, -1.0f, 1.0f, 0.5f);
SET_NM_MESSAGE_VEC3(166, -1.0f, 0.0f, 0.5f);
SET_NM_MESSAGE_VEC3(167, 0.0f, 1.0f, 0.5f);
SET_NM_MESSAGE_VEC3(168, 0.0f, 0.0f, 0.5f);
SET_NM_MESSAGE_BOOL(175, 1);
SET_NM_MESSAGE_BOOL(176, 1);
SET_NM_MESSAGE_BOOL(172, 1);
SET_NM_MESSAGE_BOOL(178, 1);
SET_NM_MESSAGE_FLOAT(164, -1.00000000);
SEND_NM_MESSAGE(MyPed);
}
}
}
}
}
if (IS_BUTTON_JUST_PRESSED(0, BUTTON_L2))
{
if (IS_PED_RAGDOLL(pPed))
{
UNLOCK_RAGDOLL(pPed, 0);
}
}
POOL *GET_VEHICLE_POOL_ADDRESS()
{
return *(POOL**)(VEHICLE_POOL_ADDRESS);
}
//Spectate cam like in gta race
Camera cam;
GET_GAME_CAM(&cam);
if (bits->Spectate)
{
SET_CAM_TARGET_PED(cam, pPed);
SET_IN_SPECTATOR_MODE(0);
SET_CAM_BEHIND_PED(pPed);
CAM_RESTORE();
SET_PLAYER_CONTROL(iPlayer, true);
SET_CHAR_VISIBLE(pPed, true);
DETACH_PED(pPed, true);
SET_CHAR_COLLISION(pPed, 1);
TELEPORT_NETWORK_PLAYER(iPlayer, 2635.00, 415, 79.00);
ToggleBool(bits->Spectate);
return;
}
if (IS_HOLY_GHOST(NetPlayerID)) return;
SET_PLAYER_CONTROL(iPlayer, false);
if (!IS_IN_SPECTATOR_MODE())
{
SET_IN_SPECTATOR_MODE(1);
}
SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS(0);
SET_CINEMATIC_BUTTON_ENABLED(0);
ACTIVATE_SCRIPTED_CAMS(0, 0);
SET_CAM_TARGET_PED(cam, NetPed);
SET_CHAR_COLLISION(pPed, 0);
SET_CHAR_VISIBLE(pPed, 0);
ToggleBool(bits->Spectate);
//rejoin freemode lobby or restart lobby if you're real host, cant remember parameters, figure them out yourself
extern _native bool NETWORK_CHANGE_GAME_MODE_E1(int a1, int a2, int a3, int MaxTeamCount, int a5, int a6, int a7, int a8)l
if (IS_NETWORK_SESSION() && !IS_THIS_MACHINE_THE_SERVER())
{
*(byte*)(FAKE_HOST) = 1;
NETWORK_CHANGE_GAME_MODE_E1(16, 16, 16, 0, 1, 0, 1, 0);
}