Как получить структуру чата?

Scrix

Известный
Автор темы
232
293
Версия MoonLoader
.026-beta
не могу получить структуру чата это крашит скрипт
Код:
local ffi = require "ffi" -- подключаем FFI
ffi.cdef[[
    struct stChatInfo
    {
        int                    pagesize;
        char                *pLastMsgText;
        int                    iChatWindowMode;
        uint8_t                bTimestamps;
        uint32_t            m_iLogFileExist;
        char                logFilePathChatLog[MAX_PATH + 1];
        void                *pGameUI;
        void                *pEditBackground;
        void                *pDXUTScrollBar;
        D3DCOLOR            clTextColor;
        D3DCOLOR            clInfoColor;
        D3DCOLOR            clDebugColor;
        DWORD                m_lChatWindowBottom;
        struct stChatEntry    chatEntry[100];
        stFontRenderer        *m_pFontRenderer;
        ID3DXSprite            *m_pChatTextSprite;
        ID3DXSprite            *m_pSprite;
        IDirect3DDevice9    *m_pD3DDevice;
        int                m_iRenderMode;
        ID3DXRenderToSurface    *pID3DXRenderToSurface;
        IDirect3DTexture9    *m_pTexture;
        IDirect3DSurface9    *pSurface;
        D3DDISPLAYMODE        *pD3DDisplayMode;
        int                    iUnk1[3];
        int                    iUnk2;
        int                    m_iRedraw;
        int                    m_nPrevScrollBarPosition;
        int                    m_iFontSizeY;
        int                    m_iTimestampWidth;
        int                    m_iTimeStampTextOffset;
    } __attribute__ ((packed));
]]

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    chat = ffi.cast('struct stChatInfo*', sampGetChatInfoPtr())
    sampAddChatMessage(chat.pagesize,0xfffffff)
    while true do wait(0)
    end
end
 

kin4stat

mq-team
Всефорумный модератор
2,730
4,710
Конечно крашит, ты половину типов не объявил

Это как ты прикажешь бригаде рабочих специализирующихся на укладке кирпича собрать тебе тачку, сказав им из чего она состоит