Исходник Underground Invisible

™ ChipFamily

По ту сторону надежды.
Автор темы
5,143
1,984
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
В теме с кряком я кидал сурс, закину отдельной темой дабы мне постоянно не писали в личные сообщение где скачать.
Lua:
local event = require('lib.samp.events')
local imgui = require('imgui')
local inicfg = require('inicfg')

local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local i_menu = imgui.ImBool(false)
local i_allert = imgui.ImBool(true)
local i_onfoot = imgui.ImBool(true)
local i_incar = imgui.ImBool(true)
local i_onfoot_glubina = imgui.ImInt(5.0)
local i_incar_glubina = imgui.ImInt(5.0)
local i_autovisota = imgui.ImBool(false)
local i_litespusk = imgui.ImBool(false)

local invis_down = false
local invis_state = false
local invis_priv = true

function imgui.OnDrawFrame()
    local xw, yw = getScreenResolution()
    if i_menu.v then
        imgui.SetNextWindowSize(imgui.ImVec2(600, 210), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(xw/2 - 200, yw/2), imgui.Cond.FirstUseEver)
        imgui.Begin(u8'Invisible v0.3.4 | by MrCreepTon', i_menu, imgui.WindowFlags.NoResize)
        imgui.BeginChild('##bar', imgui.ImVec2(300, 175), true)
        imgui.Checkbox(u8'Onfoot невидимка', i_onfoot)
        if i_onfoot.v then
            imgui.SliderInt(u8'Глубина##1', i_onfoot_glubina, 2, 150)
        end
        imgui.Checkbox(u8'Incar невидимка', i_incar)
        if i_incar.v then
            imgui.SliderInt(u8'Глубина##2', i_incar_glubina, 2, 150)
        end
        imgui.Separator()
        if invis_priv == true then
            imgui.TextColoredRGB('Статус привязки: {00DD00}Активировано')
        else
            imgui.TextColoredRGB('Статус привязки: {FF5656}Не активировано')
        end
        imgui.TextColoredRGB('Ваш код: {2CB6DD}'..getserial())
        imgui.TextColoredRGB('ВК разработчика: {2CB6DD}vk.com/haclourred')
        imgui.EndChild()
        imgui.SameLine()
        imgui.BeginChild('##settings', imgui.ImVec2(280, 175), true)
        imgui.Checkbox(u8'Оповещения в чат', i_allert)
        imgui.Checkbox(u8'Автоподбор высоты земли', i_autovisota)
        imgui.Checkbox(u8'Плавный спуск', i_litespusk)
        if invis_down then
            imgui.TextColoredRGB('{FF5656}Внимание! Скрипт опускает вас под землю...')
        else
            imgui.Text(u8'')
        end
        if invis_state then
            if imgui.Button(u8'Выключить инвиз', imgui.ImVec2(-0.1, 20)) then
                invis()
            end
        else
            if imgui.Button(u8'Включить инвиз', imgui.ImVec2(-0.1, 20)) then
                invis()
            end
        end
        if imgui.Button(u8'Сохранить настройки', imgui.ImVec2(-0.1, 20)) then
            inicfg.save({
                settings =
                {
                    onfoot = i_onfoot.v,
                    incar = i_incar.v,
                    onfoot_glubina = i_onfoot_glubina.v,
                    incar_glubina = i_incar_glubina.v,
                    allert = i_allert.v,
                    autovisota = i_autovisota.v,
                    litespusk = i_litespusk.v
                }
            }, 'invisible0.3.4')
        end
        if imgui.Button(u8'Сбросить настройки', imgui.ImVec2(-0.1, 20)) then
            inicfg.save({
                settings =
                {
                    onfoot = true,
                    incar = true,
                    onfoot_glubina = 5,
                    incar_glubina = 5,
                    allert = true,
                    autovisota = false,
                    litespusk = false
                }
            }, 'invisible0.3.4')
            i_allert = imgui.ImBool(true)
            i_onfoot = imgui.ImBool(true)
            i_incar = imgui.ImBool(true)
            i_onfoot_glubina = imgui.ImInt(5.0)
            i_incar_glubina = imgui.ImInt(5.0)
            i_autovisota = imgui.ImBool(false)
            i_litespusk = imgui.ImBool(false)
        end
        imgui.EndChild()
        imgui.End()
    end
end

function main()
    repeat wait(0) until isSampAvailable()
    repeat wait(0) until invis_priv == true
    local inik = inicfg.load(nil, 'invisible0.3.4')
    if inik == nil then
        inicfg.save({
            settings =
            {
                onfoot = true,
                incar = true,
                onfoot_glubina = 5,
                incar_glubina = 5,
                allert = true,
                autovisota = false,
                litespusk = false
            }
        }, 'invisible0.3.4')
        sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}INI файл не найден, он автоматически создан!', -1)
    end
    local inik = inicfg.load(nil, 'invisible0.3.4')
    i_onfoot.v = inik.settings.onfoot
    i_incar.v = inik.settings.incar
    i_onfoot_glubina.v = inik.settings.onfoot_glubina
    i_incar_glubina.v = inik.settings.incar_glubina
    i_allert.v = inik.settings.allert
    i_autovisota.v = inik.settings.autovisota
    i_litespusk.v = inik.settings.litespusk
    wait(2000)
    sampRegisterChatCommand('invis', invis)
    sampRegisterChatCommand('invismenu', menu)
    if i_allert.v then
        sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}Загружен!', -1)
        sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}Автор: {2CB6DD}MrCreepTon', -1)
    end
    while true do
        wait(0)
        imgui.Process = i_menu.v
    end
end

function menu()
    i_menu.v = not i_menu.v
end

function invis()
    if invis_state then
        lua_thread.create(up)
        invis_state = false
    else
        lua_thread.create(down)
        invis_state = true
    end
end

function down()
    if isCharOnFoot(PLAYER_PED) then
        local X, Y, Z = getCharCoordinates(PLAYER_PED)
        local Zt = Z - i_onfoot_glubina.v
        local oZ = Z
        invis_down = true
        while Z > Zt do
            Z = Z - 1
            local data = samp_create_sync_data('player')
            data.health = getCharHealth(PLAYER_PED)
            data.armor = getCharArmour(PLAYER_PED)
            data.weapon = getCurrentCharWeapon(PLAYER_PED)
            data.position.x = X
            data.position.y = Y
            data.position.z = Z
            data.send()
            if i_litespusk.v then
                wait(10)
            end
        end
        invis_down = false
        if i_allert.v then
            sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}Включен!', -1)
        end
    else
        local veh = getCarCharIsUsing(PLAYER_PED)
        local X, Y, Z = getCharCoordinates(PLAYER_PED)
        local Zt = Z - i_incar_glubina.v
        invis_down = true
        while Z > Zt do
            Z = Z - 1
            local data = samp_create_sync_data('vehicle')
            data.vehicleHealth = getCarHealth(veh)
            data.playerHealth = getCharHealth(PLAYER_PED)
            data.armor = getCharArmour(PLAYER_PED)
            data.currentWeapon = getCurrentCharWeapon(PLAYER_PED)
            data.position.x = X
            data.position.y = Y
            data.position.z = Z
            data.send()
            if i_litespusk.v then
                wait(10)
            end
        end
        invis_down = false
        if i_allert.v then
            sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}Включен!', -1)
        end
    end
end

function up()
    if isCharOnFoot(PLAYER_PED) then
        local X, Y, Z = getCharCoordinates(PLAYER_PED)
        local Zt = Z - i_onfoot_glubina.v
        invis_down = true
        while Zt < Z do
            Zt = Zt + 1
            local data = samp_create_sync_data('player')
            data.health = getCharHealth(PLAYER_PED)
            data.armor = getCharArmour(PLAYER_PED)
            data.weapon = getCurrentCharWeapon(PLAYER_PED)
            data.position.x = X
            data.position.y = Y
            data.position.z = Zt
            data.send()
            if i_litespusk.v then
                wait(10)
            end
        end
        invis_down = false
        if i_allert.v then
            sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}Выключен!', -1)
        end
    else
        local veh = getCarCharIsUsing(PLAYER_PED)
        local X, Y, Z = getCharCoordinates(PLAYER_PED)
        local Zt = Z - i_incar_glubina.v
        invis_down = true
        while Zt < Z do
            Zt = Zt + 1
            local data = samp_create_sync_data('vehicle')
            data.vehicleHealth = getCarHealth(veh)
            data.playerHealth = getCharHealth(PLAYER_PED)
            data.armor = getCharArmour(PLAYER_PED)
            data.currentWeapon = getCurrentCharWeapon(PLAYER_PED)
            data.position.x = X
            data.position.y = Y
            data.position.z = Zt
            data.send()
            if i_litespusk.v then
                wait(10)
            end
        end
        invis_down = false
        if i_allert.v then
            sampAddChatMessage('{2CB6DD}[Invisible]: {FFFFFF}Выключен!', -1)
        end
    end
end

function async_http_request(method, url, args, resolve, reject)
    local request_lane = lanes.gen('*', {package = {path = package.path, cpath = package.cpath}}, function()
        local requests = require 'requests'
        local ok, result = pcall(requests.request, method, url, args)
        if ok then
            result.json, result.xml = nil, nil -- cannot be passed through a lane
            return true, result
        else
            return false, result -- return error
        end
    end)
    if not reject then reject = function() end end
    lua_thread.create(function()
        local lh = request_lane()
        while true do
            local status = lh.status
            if status == 'done' then
                local ok, result = lh[1], lh[2]
                if ok then resolve(result) else reject(result) end
                return
            elseif status == 'error' then
                return reject(lh[1])
            elseif status == 'killed' or status == 'cancelled' then
                return reject(status)
            end
            wait(0)
        end
    end)
end

function event.onSendPlayerSync(data)
    if invis_down then
        return false
    elseif invis_state and i_onfoot.v then
        local X, Y, Z = getCharCoordinates(PLAYER_PED)
        if i_autovisota.v then
            local Zt = getGroundZFor3dCoord(X, Y, Z + 100)
            data.position.z = Zt - i_onfoot_glubina.v
        else
            data.position.z = Z - i_onfoot_glubina.v
        end
    end
end

function event.onPassengerSync(data)
    if invis_state and i_incar.v then
        return false
    end
end

function event.onSendVehicleSync(data)
    if invis_down then
        return false
    elseif invis_state and i_incar.v then
        local X, Y, Z = getCharCoordinates(PLAYER_PED)
        if i_autovisota.v then
            local Zt = getGroundZFor3dCoord(X, Y, Z + 100)
            data.position.z = Zt - i_incar_glubina.v
        else
            data.position.z = Z - i_incar_glubina.v
        end
    end
end

function getserial()
    local ffi = require("ffi")
    ffi.cdef[[
    int __stdcall GetVolumeInformationA(
    const char* lpRootPathName,
    char* lpVolumeNameBuffer,
    uint32_t nVolumeNameSize,
    uint32_t* lpVolumeSerialNumber,
    uint32_t* lpMaximumComponentLength,
    uint32_t* lpFileSystemFlags,
    char* lpFileSystemNameBuffer,
    uint32_t nFileSystemNameSize
    );
    ]]
    local serial = ffi.new("unsigned long[1]", 0)
    ffi.C.GetVolumeInformationA(nil, nil, 0, serial, nil, nil, nil, 0)
    return serial[0]
end

function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    style.WindowRounding = 2.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
    style.ChildWindowRounding = 2.0
    style.FrameRounding = 2.0
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0
    -- style.Alpha =
    -- style.WindowPadding =
    -- style.WindowMinSize =
    -- style.FramePadding =
    -- style.ItemInnerSpacing =
    -- style.TouchExtraPadding =
    -- style.IndentSpacing =
    -- style.ColumnsMinSpacing = ?
    -- style.ButtonTextAlign =
    -- style.DisplayWindowPadding =
    -- style.DisplaySafeAreaPadding =
    -- style.AntiAliasedLines =
    -- style.AntiAliasedShapes =
    -- style.CurveTessellationTol =

    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
    colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.ComboBg]                = colors[clr.PopupBg]
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]                = ImVec4(0.16, 0.29, 0.48, 0.54)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.29, 0.48, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.52, 0.88, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Button]                 = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.53, 0.98, 1.00)
    colors[clr.Header]                 = ImVec4(0.26, 0.59, 0.98, 0.31)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.59, 0.98, 0.80)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.26, 0.59, 0.98, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.59, 0.98, 0.95)
    colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 0.50)
    colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 1.00)
    colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 1.00)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
end

apply_custom_style()


function samp_create_sync_data(sync_type, copy_from_player)
    local ffi = require 'ffi'
    local sampfuncs = require 'sampfuncs'
    -- from SAMP.Lua
    local raknet = require 'samp.raknet'

    copy_from_player = copy_from_player or true
    local sync_traits = {
        player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
        vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
        passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
        aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
        trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
        unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
        bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
        spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
    }
    local sync_info = sync_traits[sync_type]
    local data_type = 'struct ' .. sync_info[1]
    local data = ffi.new(data_type, {})
    local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
    -- copy player's sync data to the allocated memory
    if copy_from_player then
        local copy_func = sync_info[3]
        if copy_func then
            local _, player_id
            if copy_from_player == true then
                _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
            else
                player_id = tonumber(copy_from_player)
            end
            copy_func(player_id, raw_data_ptr)
        end
    end
    -- function to send packet
    local func_send = function()
        local bs = raknetNewBitStream()
        raknetBitStreamWriteInt8(bs, sync_info[2])
        raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
        raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
        raknetDeleteBitStream(bs)
    end
    -- metatable to access sync data and 'send' function
    local mt = {
        __index = function(t, index)
            return data[index]
        end,
        __newindex = function(t, index, value)
            data[index] = value
        end
    }
    return setmetatable({send = func_send}, mt)
end

function imgui.TextColoredRGB(text)
    local style = imgui.GetStyle()
    local colors = style.Colors
    local ImVec4 = imgui.ImVec4

    local explode_argb = function(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end

    local getcolor = function(color)
        if color:sub(1, 6):upper() == 'SSSSSS' then
            local r, g, b = colors[1].x, colors[1].y, colors[1].z
            local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
            return ImVec4(r, g, b, a / 255)
        end
        local color = type(color) == 'string' and tonumber(color, 16) or color
        if type(color) ~= 'number' then return end
        local r, g, b, a = explode_argb(color)
        return imgui.ImColor(r, g, b, a):GetVec4()
    end

    local render_text = function(text_)
        for w in text_:gmatch('[^\r\n]+') do
            local text, colors_, m = {}, {}, 1
            w = w:gsub('{(......)}', '{%1FF}')
            while w:find('{........}') do
                local n, k = w:find('{........}')
                local color = getcolor(w:sub(n + 1, k - 1))
                if color then
                    text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
                    colors_[#colors_ + 1] = color
                    m = n
                end
                w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
            end
            if text[0] then
                for i = 0, #text do
                    imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
                    imgui.SameLine(nil, 0)
                end
                imgui.NewLine()
            else imgui.Text(u8(w)) end
        end
    end

    render_text(text)
end
 
  • Bug
Реакции: Shepi