
11.10.2019, 22:35
|
|
Постоянный
Регистрация: 25.12.2018
Сообщений: 568
С нами:
3886298
Репутация:
113
|
|
Описание: находит ближайшую кость противника к прицелу.
Код:
C++:
[CODE]
CVector
GetBonePos
(
INT ID
,
eBone eBone
,
BOOL isOnScreen
)
{
if
(
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
iIsListed
[
ID
]
!=
1
||
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pRemotePlayer
[
ID
]
==
NULL
||
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pRemotePlayer
[
ID
]
->
pPlayerData
==
NULL
||
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pRemotePlayer
[
ID
]
->
pPlayerData
->
pSAMP_Actor
==
NULL
||
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pRemotePlayer
[
ID
]
->
pPlayerData
->
pSAMP_Actor
->
pGTA_Ped
==
NULL
)
return
CVector
(
0.0F
,
0.0F
,
0.0F
)
;
if
(
isOnScreen
)
{
CVector BonePosition
;
CVector2D BonePositionOnScreen
;
GAME
->
GetPools
(
)
->
GetPed
(
(
DWORD
*
)
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pRemotePlayer
[
ID
]
->
pPlayerData
->
pSAMP_Actor
->
pGTA_Ped
)
->
GetTransformedBonePosition
(
eBone
,
&
BonePosition
)
;
SF
->
getGame
(
)
->
convert3DCoordsToScreen
(
BonePosition
.
fX
,
BonePosition
.
fY
,
BonePosition
.
fZ
,
&
BonePositionOnScreen
.
fX
,
&
BonePositionOnScreen
.
fY
)
;
return
CVector
(
BonePositionOnScreen
.
fX
,
BonePositionOnScreen
.
fY
,
0.0F
)
;
}
else
{
CVector BonePosition
;
GAME
->
GetPools
(
)
->
GetPed
(
(
DWORD
*
)
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pRemotePlayer
[
ID
]
->
pPlayerData
->
pSAMP_Actor
->
pGTA_Ped
)
->
GetTransformedBonePosition
(
eBone
,
&
BonePosition
)
;
return
CVector
(
BonePosition
.
fX
,
BonePosition
.
fY
,
BonePosition
.
fZ
)
;
}
}
eBone
GetNearestBone
(
int
iID
)
{
eBone
currentBone
[
]
=
{
BONE_RIGHTKNEE
,
BONE_LEFTKNEE
,
BONE_RIGHTELBOW
,
BONE_LEFTELBOW
,
BONE_SPINE1
,
BONE_RIGHTSHOULDER
,
BONE_LEFTSHOULDER
,
BONE_HEAD
}
,
nearestBone
;
float
currentRadius
,
maxRadius
=
20000
;
CVector posBone
;
for
(
int
i
=
0
;
i
Пример:
C++:
Код:
eBone nearestBone
=
GetNearestBone
(
playerID
)
;
|
|
|
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|