Получить корды иконок с карты ffi

ChаtGPT

Активный
Автор темы
370
93
Версия MoonLoader
.026-beta
Как можно через ffi получить координаты иконок с карты, без зависимости события onSetMapIcon
 
Решение
Lua:
local ffi = require("ffi")

ffi.cdef [[
    typedef struct CEntryExit CEntryExit;
    typedef struct CVector { float x, y, z; } CVector;

    typedef struct CRadarBlip {
        unsigned int   m_nColour; // see eBlipColour
        unsigned int   m_nEntityHandle;
        CVector        m_vecPos;
        unsigned short m_nCounter;
        float          m_fSphereRadius;
        unsigned short m_nBlipSize;
        CEntryExit    *m_pEntryExit;
        unsigned char  m_nRadarSprite; // see eRadarSprite
        unsigned char  m_bBright : 1; // It makes use of bright colors. Always set.
        unsigned char  m_bInUse : 1; // It is available.
        unsigned...

wojciech?

Известный
Проверенный
354
233
Lua:
local ffi = require("ffi")

ffi.cdef [[
    typedef struct CEntryExit CEntryExit;
    typedef struct CVector { float x, y, z; } CVector;

    typedef struct CRadarBlip {
        unsigned int   m_nColour; // see eBlipColour
        unsigned int   m_nEntityHandle;
        CVector        m_vecPos;
        unsigned short m_nCounter;
        float          m_fSphereRadius;
        unsigned short m_nBlipSize;
        CEntryExit    *m_pEntryExit;
        unsigned char  m_nRadarSprite; // see eRadarSprite
        unsigned char  m_bBright : 1; // It makes use of bright colors. Always set.
        unsigned char  m_bInUse : 1; // It is available.
        unsigned char  m_bShortRange : 1; // It doesn't show permanently on the radar.
        unsigned char  m_bFriendly : 1; // It is affected by BLIP_COLOUR_THREAT. 
        unsigned char  m_bBlipRemain : 1; // It has the priority over the entity (it will still appear after the entity's deletion).
        unsigned char  m_bBlipFade : 1; // Possibly a leftover. Always unset (unused).
        unsigned char  m_nCoordBlipAppearance : 2; // see eBlipAppearance
        unsigned char  m_nBlipDisplay : 2; // see eBlipDisplay
        unsigned char  m_nBlipType : 4; // see eBlipType
    } CRadarBlip;
]]

local ms_RadarTrace = ffi.cast("CRadarBlip*", 0xBA86F0) -- CRadarBlip[170]

-- использование
for i = 0, 169 do
  local pos = ms_RadarTrace[i].m_vecPos
  print(pos.x, pos.y, pos.z)
end
 
  • Нравится
Реакции: ChаtGPT и Vespan

ChаtGPT

Активный
Автор темы
370
93
Lua:
local ffi = require("ffi")

ffi.cdef [[
    typedef struct CEntryExit CEntryExit;
    typedef struct CVector { float x, y, z; } CVector;

    typedef struct CRadarBlip {
        unsigned int   m_nColour; // see eBlipColour
        unsigned int   m_nEntityHandle;
        CVector        m_vecPos;
        unsigned short m_nCounter;
        float          m_fSphereRadius;
        unsigned short m_nBlipSize;
        CEntryExit    *m_pEntryExit;
        unsigned char  m_nRadarSprite; // see eRadarSprite
        unsigned char  m_bBright : 1; // It makes use of bright colors. Always set.
        unsigned char  m_bInUse : 1; // It is available.
        unsigned char  m_bShortRange : 1; // It doesn't show permanently on the radar.
        unsigned char  m_bFriendly : 1; // It is affected by BLIP_COLOUR_THREAT.
        unsigned char  m_bBlipRemain : 1; // It has the priority over the entity (it will still appear after the entity's deletion).
        unsigned char  m_bBlipFade : 1; // Possibly a leftover. Always unset (unused).
        unsigned char  m_nCoordBlipAppearance : 2; // see eBlipAppearance
        unsigned char  m_nBlipDisplay : 2; // see eBlipDisplay
        unsigned char  m_nBlipType : 4; // see eBlipType
    } CRadarBlip;
]]

local ms_RadarTrace = ffi.cast("CRadarBlip*", 0xBA86F0) -- CRadarBlip[170]

-- использование
for i = 0, 169 do
  local pos = ms_RadarTrace[i].m_vecPos
  print(pos.x, pos.y, pos.z)
end
Понял. Спасибо 🫡