Показать сообщение отдельно

  #309  
Старый 06.07.2014, 12:40
pabloko
Новичок
Регистрация: 03.03.2014
Сообщений: 6
С нами: 6418306

Репутация: 0
По умолчанию

Player aimed (green triange over head)

PHP:





Код:
uint8_t
*
ptr
=
(
uint8_t
*
)
g_Players
-
>
pLocalPlayer
-
320
;
uint16_t thedata
[
5
]
;
memcpy_safe
(
&
thedata
,
ptr
+
0x2b9
,
4
)
;
int PlayerAimedID
=
thedata
[
0
]
;
//0xFFFF if not green triangle




Get AIM by collision Vehicles and Players

WARNING only works in 1920 x 1080, feel free to make some maths to get any resolution, im too lazy.

PHP:





Код:
if
(
KEY_DOWN
(
0x02
)
)
{
isAim2KeyDown
=
true
;
}
else
{
isAim2KeyDown
=
false
;
}
float pos
[
3
]
;
if
(
isAim2KeyDown
)
{
CVehicle
*
pCVehicleTeleport
=
NULL
;
CPed
*
pCPedTeleport
=
NULL
;
D3DXVECTOR3
poss
,
screenposs
;
screenposs
.
x
=
960
+
58
;
//1920/2 = 960 + 58 is the offset, feel free to make some mathematic here
screenposs
.
y
=
540
-
108
;
//1080/2 = 540 - 108 is the offset, feel free to make some mathematic here
screenposs
.
z
=
700.0
f
;
CalcWorldCoors2
(
&
screenposs
,
&
poss
)
;
CVector
vecTarget
(
poss
.
x
,
poss
.
y
,
poss
.
z
)
;
// setup variables
CVector                vecOrigin
,
vecGroundPos
;
CColPoint
*
pCollision
=
NULL
;
CEntitySAInterface
*
pCollisionEntity
=
NULL
;
// origin = our camera
vecOrigin
=
*
pGame
-
>
GetCamera
(
)
-
>
GetCam
(
pGame
-
>
GetCamera
(
)
-
>
GetActiveCam
(
)
)
-
>
GetSource
(
)
;
// check for collision
bool bCollision
=
GTAfunc_ProcessLineOfSight
(
&
vecOrigin
,
&
vecTarget
,
&
pCollision
,
&
pCollisionEntity
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
)
;
float posss
[
3
]
;
if
(
bCollision
&&
pCollision
)
{
if
(
pCollisionEntity
&&
pCollisionEntity
-
>
nType
==
ENTITY_TYPE_VEHICLE
)
{
pCVehicleTeleport
=
pGameInterface
-
>
GetPools
(
)
-
>
GetVehicle
(
(
DWORD
*
)
pCollisionEntity
)
;
if
(
pCVehicleTeleport
)
{
//vecGroundPos = *pCVehicleTeleport->GetPosition();
const
struct vehicle_entry
*
vehicleEntry
=
gta_vehicle_get_by_id
(
pCVehicleTeleport
-
>
GetModelIndex
(
)
)
;
if
(
vehicleEntry
!=
NULL
)
{
int iVehicleID
=
getVehicleGTAIDFromInterface
(
(
DWORD
*
)
pCVehicleTeleport
-
>
GetInterface
(
)
)
;
//cheat_state_text("collision %d", translateGTASAMP_pedPool.iSAMPID[iActorID]);
aimidf
=
translateGTASAMP_vehiclePool
.
iSAMPID
[
iVehicleID
]
;
cheat_state
-
>
RealAIMID
=
aimidf
;
cheat_state
-
>
TypeAIMID
=
2
;
}
}
}
// setup some stuff for normal warp
else
if
(
pCollisionEntity
&&
pCollisionEntity
-
>
nType
==
ENTITY_TYPE_PED
)
{
pCPedTeleport
=
pGameInterface
-
>
GetPools
(
)
-
>
GetPed
(
(
DWORD
*
)
pCollisionEntity
)
;
if
(
pCPedTeleport
)
{
//vecGroundPos = *pCPedTeleport->GetPosition();
int iActorID
=
getPedGTAIDFromInterface
(
(
DWORD
*
)
pCPedTeleport
-
>
GetInterface
(
)
)
;
if
(
iActorID
!=
NULL
)
{
//sprintf(buf, "Aim-menu (%d)", translateGTASAMP_pedPool.iSAMPID[iActorID]);
aimidf
=
translateGTASAMP_pedPool
.
iSAMPID
[
iActorID
]
;
cheat_state
-
>
RealAIMID
=
aimidf
;
cheat_state
-
>
TypeAIMID
=
1
;
}
}
}
}
pCollision
-
>
Destroy
(
)
;
}
//vecGroundPos = *pCollision->GetPosition();
//cheat_state_text("collision ID(%d)        %0.2f    %0.2f    Distance(%0.2f)", aimidf, (float)poss.x, (float)poss.y, vect3_dist(&vecOrigin.fX, &vecGroundPos.fX));
CVector lol
;
lol
.
fX
=
0
;
lol
.
fY
=
0
;
lol
.
fZ
=
0
;
//save current aim status
float posss
[
3
]
;
if
(
cheat_state
-
>
TypeAIMID
==
1
)
{
if
(
getPlayerPos
(
cheat_state
-
>
RealAIMID
,
posss
)
)
{
cheat_state
-
>
CurrentAIMstreamed
=
true
;
cheat_state
-
>
CurrentAIMstreamed
=
1
;
cheat_state
-
>
DistanceAIM
=
vect3_dist
(
cheat_state
-
>
actor
.
coords
,
posss
)
;
lol
.
fX
=
posss
[
0
]
;
lol
.
fY
=
posss
[
1
]
;
lol
.
fZ
=
posss
[
2
]
;
//cheat_state_text("collision ID(%d)        %0.2f    %0.2f    Distance(%0.2f) Distance(%0.2f)", aimidf, (float)poss.x, (float)poss.y, vect3_dist(&vecOrigin.fX, &vecGroundPos.fX), cheat_state->DistanceAIM);
}
else
{
cheat_state
-
>
CurrentAIMstreamed
=
false
;
cheat_state
-
>
DistanceAIM
=
0.0
f
;
}
}
if
(
cheat_state
-
>
TypeAIMID
==
2
)
{
if
(
g_Vehicles
-
>
pSAMP_Vehicle
[
cheat_state
-
>
RealAIMID
]
!=
NULL
)
{
cheat_state
-
>
CurrentAIMstreamed
=
true
;
cheat_state
-
>
DistanceAIM
=
vect3_dist
(
cheat_state
-
>
actor
.
coords
,
&
g_Vehicles
-
>
pSAMP_Vehicle
[
cheat_state
-
>
RealAIMID
]
-
>
pGTA_Vehicle
-
>
base
.
matrix
[
4
*
3
]
)
;
lol
.
fX
=
g_Vehicles
-
>
pSAMP_Vehicle
[
cheat_state
-
>
RealAIMID
]
-
>
pGTA_Vehicle
-
>
base
.
matrix
[
4
*
3
]
;
lol
.
fY
=
g_Vehicles
-
>
pSAMP_Vehicle
[
cheat_state
-
>
RealAIMID
]
-
>
pGTA_Vehicle
-
>
base
.
matrix
[
13
]
;
lol
.
fZ
=
g_Vehicles
-
>
pSAMP_Vehicle
[
cheat_state
-
>
RealAIMID
]
-
>
pGTA_Vehicle
-
>
base
.
matrix
[
14
]
;
}
else
{
cheat_state
-
>
CurrentAIMstreamed
=
false
;
cheat_state
-
>
DistanceAIM
=
0.0
f
;
}
}
 
Ответить с цитированием