```lua
-- CEF Events module для новых пакетов Arizona RP (с uint16 length и флагом encoded)

local array = {}

addEventHandler('onReceivePacket', function(id, bs)
    if id == 220 then
        raknetBitStreamIgnoreBits(bs, 8) -- пропускаем packet_id (220)
        local unknown_id = raknetBitStreamReadInt8(bs)
        if unknown_id == 17 then
            raknetBitStreamIgnoreBits(bs, 32) -- пропускаем _unused (4 байта)
            local length = raknetBitStreamReadInt16(bs)
            local encoded = raknetBitStreamReadInt8(bs)
            local str
            if encoded ~= 0 then
                str = raknetBitStreamDecodeString(bs, length + encoded)
            else
                str = raknetBitStreamReadString(bs, length)
            end
            array.onDisplayCEF(str)
        end
    end
end)

addEventHandler('onSendPacket', function(id, bs, priority, reliability, orderingChannel)
    if id == 220 then
        local packet_id = raknetBitStreamReadInt8(bs)       -- 220
        local packet_type = raknetBitStreamReadInt8(bs)     -- 18 и др.
        local strlen = raknetBitStreamReadInt16(bs)
        local str = raknetBitStreamReadString(bs, strlen)
        -- можно игнорировать _unused (4 байта) если нужно
        if packet_type ~= 0 and packet_type ~= 1 and #str > 2 then
            array.onSendCEF(str)
        end
    end
end)

-- Callback заглушки (чтобы не было nil)
array.onDisplayCEF = function(str) return str end
array.onSendCEF = function(str) return str end

-- Эмуляция отправки CEF пакета (исходящий)
function array.emulationCEF(str)
    local bs = raknetNewBitStream()
    raknetBitStreamWriteInt8(bs, 220)      -- packet_id
    raknetBitStreamWriteInt8(bs, 18)       -- packet_type (18 — CEF)
    raknetBitStreamWriteInt16(bs, #str)    -- length
    raknetBitStreamWriteString(bs, str)    -- строка
    raknetBitStreamWriteInt32(bs, 0)       -- _unused
    raknetSendBitStream(bs)
    raknetDeleteBitStream(bs)
end

-- Визуальный вызов CEF события (входящий пакет)
-- str — строка с JS вызовом, is_encoded — true если нужно кодировать (по умолчанию false)
function array.visualCEF(str, is_encoded)
    local bs = raknetNewBitStream()
    raknetBitStreamWriteInt8(bs, 17)       -- fixed unknown_id для входящего пакета
    raknetBitStreamWriteInt32(bs, 0)       -- _unused
    raknetBitStreamWriteInt16(bs, #str)    -- длина строки
    raknetBitStreamWriteInt8(bs, is_encoded and 1 or 0)
    if is_encoded then
        raknetBitStreamEncodeString(bs, str)
    else
        raknetBitStreamWriteString(bs, str)
    end
    raknetEmulPacketReceiveBitStream(220, bs)
    raknetDeleteBitStream(bs)
end

return array
--[[
[ML] (script) CEF Monitoring.lua: [12:29:14] CEF IN: window.executeEvent('event.arizonahud.speedometerType', `["null"]`);
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.arizonahud.updateGeoPositionVisibility', `[false]`);
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.arizonahud.hotkeysVisible', `[false]`);
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.setActiveView', `["MountainTestDrive"]`);
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.arizonahud.activeQuestVisible', `[false]`);
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.mountain.testDrive.initializeText', `[{"title":"Багажник","desc":"Выберите необходимый предмет или инструмент"}]`);
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.mountain.testDrive.addVehicles', `[[{"id":0,"title":"Объект ограждения","img":"600000","color":0},{"id":1,"title":"Отбойный молоток","img":"600001","color":0},{"id":2,"title":"Инструменты для починки труб","img":"6000002","color":0},{"id":3,"title":"Мешок с новым асфальтом","img":"600003","color":0},{"id":4,"title":"Ручной каток","img":"600004","color":0}]]`);
--[[
[ML] (script) CEF Monitoring.lua: [12:29:15] CEF OUT: onActiveViewChanged|MountainTestDrive
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.setActiveView', '[ null ]');
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.arizonahud.updateGeoPositionVisibility', `[true]`);
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.arizonahud.hotkeysVisible', `[true]`);
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.arizonahud.setFractionRadioKey', `[null]`);
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.arizonahud.setFamilyRadioKey', `[null]`);
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.arizonahud.setPhoneKey', `["P"]`);
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF IN: window.executeEvent('event.arizonahud.setWorkbookKey', `["Трудовая книжка", "M"]`);
[ML] (script) CEF Monitoring.lua: [12:29:25] CEF OUT: onActiveViewChanged|null
]]

```

Как сделать чтобы когда открывалось окно [ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.setActiveView', `["MountainTestDrive"]`); и в нем точно был текст Выберите необходимый предмет или инструмент ([ML] (script) CEF Monitoring.lua: [12:29:15] CEF IN: window.executeEvent('event.mountain.testDrive.initializeText', `[{"title":"Багажник","desc":"Выберите необходимый предмет или инструмент"}]`);)

То писалось ГУД