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

  #5968  
Старый 28.03.2022, 21:28
kin4stat
Флудер
Регистрация: 06.11.2017
Сообщений: 2,759
С нами: 4483143

Репутация: 183


По умолчанию

Цитата:
Сообщение от Чёрный вурдалак  

SAMP-API/include/sampapi/0.3.7-R1/CObjectPool.h at 93eb1452b0f2b9b8c540604d40e5727fabcea58f · BlastHackNet/SAMP-API

A library for interacting with functions, classes and structures of SA-MP client - BlastHackNet/SAMP-API

github.com


Get object by its ID (using SAMP-API):





Код:
CObject
*
getObjectById
(
std
::
uint32_t
id
)
{
const
auto
&
netGame
{
sampapi
::
v037r1
::
RefNetGame
(
)
}
;
if
(
nullptr
==
netGame
)
{
return
nullptr
;
}
const
auto
&
objectPool
{
netGame
->
GetObjectPool
(
)
}
;
if
(
nullptr
==
objectPool
)
{
return
nullptr
;
}
return
objectPool
->
Get
(
id
)
;
}

C++:





Код:
sampapi
::
v037r1
::
CObject
*
get_object_by_id
(
std
::
uint32_t
id
)
{
if
(
auto
net_game
=
sampapi
::
v037r1
::
RefNetGame
(
)
;
!
net_game
)
return
{
}
;
else
if
(
auto
object_pool
=
net_game
->
GetObjectPool
(
)
;
!
object_pool
)
return
{
}
;
else
return
object_pool
->
Get
(
id
)
;
}
 
Ответить с цитированием