
12.08.2025, 00:00
|
|
Флудер
Регистрация: 19.06.2022
Сообщений: 2,997
С нами:
2055431
Репутация:
3
|
|
Сообщение от daun.daunovich.01
Не могу, у меня проект создан отдельно от plugin-sdk, если я его добавлю в ручную - то он работать не будет
Не совсем понял, как это. Ты можешь просто в свой проект подключить plugin-sdk как библиотеку
Сообщение от daun.daunovich.01
Пытаюсь получить координаты локального игрока в мире, но почему-то они постоянно 0.
Что не так?
cpp:
Код:
Это R3
CVector* pos = samp->getPos();
printf("x: %f, y: %f, z: %f\n", pos->x, pos->y, pos->z);
uintptr_t* getPlayerEntity() {
uintptr_t player_pool = getPlayerPool();
uintptr_t local_info = player_pool + 0x2F14;
return reinterpret_cast(local_info + 0x2A4);
}
CVector* getPos() {
uintptr_t* gamePed = getPlayerEntity();
if (gamePed != nullptr) {
return reinterpret_cast(0x4043A0)(gamePed);
}
//return CVector(1.0, 5.0, 10.0);
}
// 0x4043A0
CSimpleTransform *__thiscall CEntity::GetPosition(CEntity *this) - функция в IDA PRO
Если getPlayerPool возвращает указатель на пул, то +- такой код (хотя опять же, есть уже все готовое: sampapi):
C++:
Код:
Это R3
CVector
*
pos
=
samp
->
getPos
(
)
;
printf
(
"x: %f, y: %f, z: %f\n"
,
pos
->
x
,
pos
->
y
,
pos
->
z
)
;
uintptr_t
*
getPlayerEntity
(
)
{
uintptr_t player_pool
=
getPlayerPool
(
)
;
uintptr_t local_info
=
player_pool
+
0x2F14
;
uintptr_t
*
local_player
=
reinterpret_cast
(
local_info
+
0x26
)
;
uintptr_t samp_ped
=
*
local_player
;
// offset 0x0 CPed
uintptr_t game_ped
=
samp_ped
+
0x2A4
;
return
game_ped
;
}
CVector
*
getPos
(
)
{
uintptr_t
*
gamePed
=
getPlayerEntity
(
)
;
if
(
gamePed
!=
nullptr
)
{
return
reinterpret_cast
(
0x4043A0
)
(
gamePed
)
;
}
//return CVector(1.0, 5.0, 10.0);
}
// 0x4043A0
CSimpleTransform
*
__thiscall CEntity
::
GetPosition
(
CEntity
*
this
)
-
функция в IDA PRO
|
|
|