Не работает скрипт

SunRays

Новичок
Автор темы
12
0
Версия MoonLoader
.026-beta
Всем привет, взял из одного скрипта AirBrake при переносе проблем не было, ошибок нету, но почему-то не работает сам AirBrake прошу помочь.


код:
script_author('#john')

require 'lib.moonloader'
local keys             = require 'vkeys'
local imgui         = require 'imgui'
local inicfg         = require 'inicfg'
local sampev        = require 'lib.samp.events'
local encoding      = require 'encoding'
encoding.default    = 'CP1251'
u8                  = encoding.UTF8

local tag = '{185aff}[NAT]: {FFFFFF}'

main_window_state = imgui.ImBool(false)

if not doesDirectoryExist('moonloader/config/NemalskAdminTools') then
    createDirectory('moonloader/config/NemalskAdminTools')
end

local mainini = inicfg.load({
config =
{
    share = false,
    wh = false,
    wh_style = 0,
    wh_path = false,
    ab = false,
    ab_playerspeed = 0.76,
    ab_vehiclespeed = 1.5,
    ab_passenger = 0.2,
    ab_syncplayerspeed = 1.8,
    ab_syncvehiclespeed = 1.2,
    ab_syncpassengerspeed = 0.5,
}
}, 'NemalskAdminTools/NemalskAdminTools')

local status = inicfg.load(mainini, 'NemalskAdminTools/NemalskAdminTools.ini')
if not doesFileExist('moonloader/config/NemalskAdminTools/NemalskAdminTools.ini') then
    inicfg.save(mainini, 'NemalskAdminTools/NemalskAdminTools.ini')
end

local share = imgui.ImBool(mainini.config.share)
local wh = imgui.ImBool(mainini.config.wh)
local wh_style = imgui.ImInt(mainini.config.wh_style)
local wh_path = imgui.ImBool(mainini.config.wh_path)
local ab = imgui.ImBool(mainini.config.ab)
local ab_playerspeed = imgui.ImFloat(mainini.config.ab_playerspeed)
local ab_vehiclespeed = imgui.ImFloat(mainini.config.ab_vehiclespeed)
local ab_passenger = imgui.ImFloat(mainini.config.ab_passenger)
local ab_syncplayerspeed = imgui.ImFloat(mainini.config.ab_syncplayerspeed)
local ab_syncvehiclespeed = imgui.ImFloat(mainini.config.ab_syncvehiclespeed)
local ab_syncpassengerspeed = imgui.ImFloat(mainini.config.ab_syncpassengerspeed)

local wh_styles = {
    [1] = u8'WH стиль #1',
    [2] = u8'WH стиль #2'
}

local savefile = 'NemalskAdminTools/NemalskAdminTools.ini'

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampAddChatMessage(tag..'Скрипт {185aff}Nemalsk Admin Tools{FFFFFF} загружен.', -1)
    sampAddChatMessage(tag..'Настройки скрипта: "{185aff}/nat{FFFFFF}".', -1)
    sampAddChatMessage(tag..'Автор скрипта {185aff}#gonzales(Roy Gonzales){FFFFFF}, мне очень приятно что ты используешь мой скрипт :D', -1)

    sampRegisterChatCommand('nat', function()
        main_window_state.v = not main_window_state.v
        imgui.Process = main_window_state.v
    end)

    _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)
    
    imgui.Process = false
    font = renderCreateFont("Arial", 10, 5)
    
    while true do
        wait(0)
        if wh.v then
            for id = 0, sampGetMaxPlayerId(true)
            do
                if sampIsPlayerConnected(id) then
                    local exists, handle = sampGetCharHandleBySampPlayerId(id)
                        if exists and doesCharExist(handle) then
                            if isCharOnScreen(handle) then

                            local color = sampGetPlayerColor(id)
                            local name = sampGetPlayerNickname(id)
                            local health = sampGetPlayerHealth(id)
                            local armor = sampGetPlayerArmor(id)
                            local weapon = getCurrentCharWeapon(handle)
                            local weap = getweaponname(weapon)
                            local ping = sampGetPlayerPing(id)
                            local X, Y, Z = getCharCoordinates(handle)
                            local x, y = convert3DCoordsToScreen(X, Y, Z)
                            local myX, myY, myZ = getCharCoordinates(playerPed)
                            local myx, myy = convert3DCoordsToScreen(myX, myY, myZ)
                            local distance = getDistanceBetweenCoords3d(X, Y, Z, myX, myY, myZ)
                            local model = getCharModel(handle)

                            if mainini.config.wh_style == 0 then
                                if not sampIsPlayerPaused(id) then
                                    renderFontDrawText(font, string.format("%s[%d]", name, id), x, y, color)
                                else
                                    renderFontDrawText(font, string.format("%s[%d] (AFK)", name, id), x, y, color)
                                end
                            end

                            distance = math.ceil(distance)
                            if mainini.config.wh_style == 1 then
                                if not sampIsPlayerPaused(id) then
                                    renderFontDrawText(font, string.format("%s[%d]\n%d HP | %d AP\nPing: %d\nWeapon: %s\nDistance: %d", name, id, health, armor, ping, weap, distance), x, y, color)
                                else
                                    renderFontDrawText(font, string.format("%s[%d] (AFK)\n%d HP | %d AP\nPing: %d\nWeapon: %s\nDistance: %d", name, id, health, armor, ping, weap, distance), x, y, color)
                                end
                            end

                            if wh_path.v then
                                renderDrawLine(myx, myy, x, y, 2, color)
                                renderDrawPolygon(x, y, 5, 5, 15, 0, color)
                            end
                        end
                    end
                end
            end
        end   
    end
end

function imgui.OnDrawFrame()

    if not main_window_state.v then
        imgui.Process = false
    end

    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(800, 400), imgui.Cond.FirstUseEver)
        imgui.Begin('Renaissance Helper ', main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoSavedSettings)
        if not menu then menu = 1 end

        imgui.BeginChild('#Menu', imgui.ImVec2(150, 365), true)
            if imgui.Button(u8'Настройки',imgui.ImVec2(134, 50)) then
                menu = 1
            end
            if imgui.Button(u8'Авто. доклад',imgui.ImVec2(134, 50)) then
                menu = 2
            end
            if imgui.Button(u8'Автор',imgui.ImVec2(134, 50)) then
                menu = 3
            end
        imgui.EndChild()

        imgui.SameLine()

        imgui.BeginChild('#Desktop', imgui.ImVec2(629, 365), true)
        if menu == 1 then

            if imgui.Checkbox(u8'Акциент администратора', share) then
                mainini.config.share = share.v
                inicfg.save(mainini, savefile)
            end   

            imgui.Separator()
            
            imgui.CenterTextColoredRGB('Читы для администрации')
            
            imgui.Separator()
            
            if imgui.Checkbox(u8'WH', wh) then
                mainini.config.wh = wh.v
                inicfg.save(mainini, savefile)
            end   
            
            if wh.v then
                imgui.SameLine()
                imgui.SetCursorPosX(350)
                imgui.BeginChild('#WH.V', imgui.ImVec2(273, 35), true)
                    if imgui.Checkbox(u8'WH path', wh_path) then
                        mainini.config.wh_path = wh_path.v
                        inicfg.save(mainini, savefile)
                    end   
                    
                    imgui.SameLine()
                    imgui.SetCursorPosX(117)
                    imgui.PushItemWidth(150)
                    if imgui.Combo('##WH_STYLES', wh_style, wh_styles) then
                        mainini.config.wh_style = wh_style.v
                        inicfg.save(mainini, savefile)
                    end
                    imgui.PopItemWidth()
                imgui.EndChild()       
            end
                
            if imgui.Checkbox(u8'AirBrake', ab) then
                mainini.config.ab = ab.v
                inicfg.save(mainini, savefile)
            end   
            
            if ab.v then
                imgui.SameLine()
                imgui.SetCursorPosX(350)
                imgui.BeginChild('#AB.V', imgui.ImVec2(273, 100), true)
                    imgui.PushItemWidth(250)
                        if imgui.SliderFloat('##ab_playerspeed', ab_playerspeed, 0, 3, u8'%0.02f - скорость игрока') then
                            mainini.config.ab_playerspeed = ab_playerspeed.v
                            inicfg.save(mainini, savefile)
                        end
                        if imgui.SliderFloat('##ab_vehiclespeed', ab_vehiclespeed, 0, 3, u8'%0.02f - скорость транспорта') then
                            mainini.config.ab_vehiclespeed = ab_vehiclespeed.v
                            inicfg.save(mainini, savefile)
                        end
                        if imgui.SliderFloat('##ab_passenger', ab_passenger, 0, 3, u8'%0.02f - сколько пассажира') then
                            mainini.config.ab_passenger = ab_passenger.v
                            inicfg.save(mainini, savefile)
                        end
                        if imgui.SliderFloat('##ab_syncpassengerspeed', ab_syncpassengerspeed, 0, 3, u8'%0.02f - скорсть sync пассажира') then
                            mainini.config.ab_syncpassengerspeed = ab_syncpassengerspeed.v
                            inicfg.save(mainini, savefile)
                        end
                        if imgui.SliderFloat('##ab_syncplayerspeed', ab_syncplayerspeed, 0, 3, u8'%0.02f - скорсть sync игрока') then
                            mainini.config.ab_syncplayerspeed = ab_syncplayerspeed.v
                            inicfg.save(mainini, savefile)
                        end
                        if imgui.SliderFloat('##ab_syncvehiclespeed', ab_syncvehiclespeed, 0, 3, u8'%0.02f - скорсть sync транспорта') then
                            mainini.config.ab_syncvehiclespeed = ab_syncvehiclespeed.v
                            inicfg.save(mainini, savefile)
                        end
                    imgui.PopItemWidth()
                imgui.EndChild()
            end   
        end
        if menu == 2 then
            
        end
        if menu == 3 then
            if imgui.Button(u8'Форумный аккаунт разработчика ',imgui.ImVec2(612, 30)) then
                os.execute('explorer https://forum-nemalsk-rp.tk/members/roy_gonzales.412/')
            end
            if imgui.Button(u8'Вконакте разработчика ',imgui.ImVec2(612, 30)) then
                os.execute('explorer https://vk.com/n.ermak_play')
            end

            imgui.Separator()

            imgui.CenterTextColoredRGB('Версия скрипта: {FF0000}1.0')
        end
        imgui.EndChild()

        imgui.End()
    end
end

function airbrake()
    if ab.v then
        active = not active
        if not active then return end
        while active do wait(0)

            if isCharInAnyCar(PLAYER_PED) then setCarHeading(getCarCharIsUsing(PLAYER_PED), getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) if getDriverOfCar(getCarCharIsUsing(PLAYER_PED)) == -1 then speed = getFullSpeed(ab_passenger, 0, 0) else speed = getFullSpeed(ab_vehiclespeed, 0, 0) end else speed = getFullSpeed(ab_playerspeed, 0, 0) setCharHeading(PLAYER_PED, getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) end

            if sampIsCursorActive() then goto mark end

            if isKeyDown(VK_SPACE) then airBrkCoords[3] = airBrkCoords[3] + speed / 2 elseif isKeyDown(VK_LSHIFT) and airBrkCoords[3] > -95.0 then airBrkCoords[3] = airBrkCoords[3] - speed / 2 end

            if isKeyDown(VK_W) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) elseif isKeyDown(VK_S) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) end
            if isKeyDown(VK_A) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) elseif isKeyDown(VK_D) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) end

            ::mark::
            setCharCoordinates(PLAYER_PED, airBrkCoords[1], airBrkCoords[2], airBrkCoords[3])

        end
    end   
end

function sampev.onSendPlayerSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncplayerspeed)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendVehicleSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncvehiclespeed)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendUnoccupiedSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncpassengerspeed)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendPassengerSync(data)
    if not active then return end

    pcall(onSendUnoccupiedSync, data.vehicleId, data.seatId)
    data.position = {getCharCoordinates(PLAYER_PED)}
    return data
end

function getMoveSpeed(heading, speed)
    moveSpeed = {x = math.sin(-math.rad(heading)) * (speed), y = math.cos(-math.rad(heading)) * (speed), z = 0}
    return moveSpeed
end


function getFullSpeed(speed, ping, min_ping)
    local fps = require('memory').getfloat(0xB7CB50, true)
    local result = (speed / (fps / 60))
    if ping == 1 then
        local ping = sampGetPlayerPing(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))
        if min_ping < ping then
            result = (result / (min_ping / ping))
        end
    end
    return result
end

function onWindowMessage(msg, wparam, lparam)
    if(msg == 0x100 or msg == 0x101) then
        if lparam == 3538945 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then
            airBrkCoords = {getCharCoordinates(PLAYER_PED)}
            if not isCharInAnyCar(PLAYER_PED) then
                airBrkCoords[3] = airBrkCoords[3] - 1
            end
        end
    end
end

function getweaponname(weapon)
  local names = {
  [0] = "Fist",
  [1] = "Brass Knuckles",
  [2] = "Golf Club",
  [3] = "Nightstick",
  [4] = "Knife",
  [5] = "Baseball Bat",
  [6] = "Shovel",
  [7] = "Pool Cue",
  [8] = "Katana",
  [9] = "Chainsaw",
  [10] = "Purple Dildo",
  [11] = "Dildo",
  [12] = "Vibrator",
  [13] = "Silver Vibrator",
  [14] = "Flowers",
  [15] = "Cane",
  [16] = "Grenade",
  [17] = "Tear Gas",
  [18] = "Molotov Cocktail",
  [22] = "9mm",
  [23] = "Silenced 9mm",
  [24] = "Desert Eagle",
  [25] = "Shotgun",
  [26] = "Sawnoff Shotgun",
  [27] = "Combat Shotgun",
  [28] = "Micro SMG/Uzi",
  [29] = "MP5",
  [30] = "AK-47",
  [31] = "M4",
  [32] = "Tec-9",
  [33] = "Country Rifle",
  [34] = "Sniper Rifle",
  [35] = "RPG",
  [36] = "HS Rocket",
  [37] = "Flamethrower",
  [38] = "Minigun",
  [39] = "Satchel Charge",
  [40] = "Detonator",
  [41] = "Spraycan",
  [42] = "Fire Extinguisher",
  [43] = "Camera",
  [44] = "Night Vis Goggles",
  [45] = "Thermal Goggles",
  [46] = "Parachute" }
  return names[weapon]
end

function imgui.VerticalSeparator()
    local p = imgui.GetCursorScreenPos()
    imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y), imgui.ImVec2(p.x, p.y + imgui.GetContentRegionMax().y), imgui.GetColorU32(imgui.GetStyle().Colors[imgui.Col.Separator]))
end

function sampev.onSendChat(message, msg)
    if share.v then
        if message == ')' or message == '(' or message ==  '))' or message == '((' or message == 'xD' or message == ':D' or message == ':d' or message == 'XD' then return{message} end
    return{'[A]: '..message}
    end
    if msg:find('{sex:%A+|%A+}') then
        local male, female = msg:match('{sex:(%A+)|(%A+)}')
        if mainini.config.sex == 0 then
            local returnMsg = msg:gsub('{sex:%A+|%A+}', male, 1)
            sampSendChat(tostring(returnMsg))
            return false
            else
            local returnMsg = msg:gsub('{sex:%A+|%A+}', female, 1)
            sampSendChat(tostring(returnMsg))
            return false
        end
    end
end

function imgui.CenterTextColoredRGB(text)
    local width = imgui.GetWindowWidth()
    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 textsize = w:gsub('{.-}', '')
    local text_width = imgui.CalcTextSize(u8(textsize))
    imgui.SetCursorPosX( width / 2 - text_width .x / 2 )
    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

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

function theme()
    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

    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.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.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
    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.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.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.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
end
theme()
 
Решение
Lua:
script_author('#john')

require 'lib.moonloader'
local keys             = require 'vkeys'
local imgui         = require 'imgui'
local inicfg         = require 'inicfg'
local sampev        = require 'lib.samp.events'
local encoding      = require 'encoding'
encoding.default    = 'CP1251'
u8                  = encoding.UTF8

local tag = '{185aff}[NAT]: {FFFFFF}'

main_window_state = imgui.ImBool(false)

if not doesDirectoryExist('moonloader/config/NemalskAdminTools') then
    createDirectory('moonloader/config/NemalskAdminTools')
end

local mainini = inicfg.load({
config =
{
    share = false,
    wh = false,
    wh_style = 0,
    wh_path = false,
    ab = false,
    ab_playerspeed = 0.76,
    ab_vehiclespeed = 1.5,
    ab_passenger =...

SunRays

Новичок
Автор темы
12
0
Не ну норм, вызывать имгуй окна, не добавив процесс в беск цикл
Lua:
    while true do wait(0) -- находится в main()
        imgui.Process = main_window_state.v
Это всё конечно да, но вот почему AirBrake не работает?
 

SunRays

Новичок
Автор темы
12
0
потому что функция Airbrake() нигде не объявлена
Хз, делал всё также как в другом скрипте.

скрипт откуда взял аир:
script_author('https://www.blast.hk/members/117882/')
script_name('AirBrake.v7')

local sampev = require('lib.samp.events')
local inicfg = require('inicfg')

require"lib.moonloader"
require"lib.sampfuncs"

local direct = 'moonloader\\config\\airbrake_v7.ini'

local function messages(text)
    sampAddChatMessage('{FFFFFF}[{00DD00}AirBrake.V7{FFFFFF}] - {FFC000}'..tostring(text), 0x4B0082)
end

function main() if not isSampfuncsLoaded() or not isSampLoaded() then return end repeat wait(0) until isSampAvailable() messages('Автор: 00DD00 & || NN - NoName ||') iniLoad() sampRegisterChatCommand('airbrake', function() lua_thread.create(set) end) wait(-1) end

function airbrake()
    active = not active
    printStringNow(active and '~S~Air~P~Brake ~B~Activated~N~~R~Author: ~G~00DD00 | NN - NoName' or '~S~Air~P~Brake ~B~De-Activated~N~~R~Author: ~G~00DD00 | NN - NoName', 5000)
    if not active then return end
    while active do wait(0)

        if isCharInAnyCar(PLAYER_PED) then setCarHeading(getCarCharIsUsing(PLAYER_PED), getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) if getDriverOfCar(getCarCharIsUsing(PLAYER_PED)) == -1 then speed = getFullSpeed(speed_passenger, 0, 0) else speed = getFullSpeed(speed_vehicle, 0, 0) end else speed = getFullSpeed(speed_player, 0, 0) setCharHeading(PLAYER_PED, getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) end

        if sampIsCursorActive() then goto mark end

        if isKeyDown(VK_SPACE) then airBrkCoords[3] = airBrkCoords[3] + speed / 2 elseif isKeyDown(VK_LSHIFT) and airBrkCoords[3] > -95.0 then airBrkCoords[3] = airBrkCoords[3] - speed / 2 end

        if isKeyDown(VK_W) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) elseif isKeyDown(VK_S) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) end
        if isKeyDown(VK_A) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) elseif isKeyDown(VK_D) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) end

        ::mark::
        setCharCoordinates(PLAYER_PED, airBrkCoords[1], airBrkCoords[2], airBrkCoords[3])

    end
end

function sampev.onSendPlayerSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), speed_player_sync)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendVehicleSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), speed_vehicle_sync)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendUnoccupiedSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), speed_passenger_sync)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendPassengerSync(data)
    if not active then return end

    pcall(onSendUnoccupiedSync, data.vehicleId, data.seatId)
    data.position = {getCharCoordinates(PLAYER_PED)}
    return data
end

function getMoveSpeed(heading, speed)
    moveSpeed = {x = math.sin(-math.rad(heading)) * (speed), y = math.cos(-math.rad(heading)) * (speed), z = 0}
    return moveSpeed
end

function set()

    -- Да-да, я знаю что использовать такую хуйню как внизу, это говнокод. Но мне так было легче, так что пошли на хуй.

    local m_set = {
        {'Скорость персонажа', speed_player},
        {'Скорость машины', speed_vehicle},
        {'Скорость пассажира', speed_passenger},
        {'Скорость синхры персонажа', speed_player_sync},
        {'Скорость синхры машины', speed_vehicle_sync},
        {'Скорость синхры пассажира', speed_passenger_sync}
    }

    local text = nil

    for i = 1, #m_set do if text == nil then text = '{00DD00}Наименование\t{FFC000}Значение\n{FFC000}'..m_set[i][1]..'\t{00DD00}'..m_set[i][2]..'\n' else text = text..'{FFC000}'..m_set[i][1]..'\t{00DD00}'..m_set[i][2]..'\n' end end

    ::dialog::
    sampShowDialog(1337228, '{00FF00}Air{FFD700}Brake {FF00FF}V7', text, '{00DD00}Next', '{FF0000}Exit', 5)
    repeat wait(0) until not sampIsDialogActive(1337228)
    local res, button, list, input = sampHasDialogRespond(1337228)
    if button ~= 1 then return end
    
    if list == 0 then
        ::dialog0::
        sampShowDialog(1337, '{FFD700}Speed {00FF00}Player', '{FFC000}Настройка скорости персонажа.\n\nСтандартное значение: {00FF00}0.76\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_player, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(1337)
        local res, button, list, input = sampHasDialogRespond(1337)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog0 end
        speed_player = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 1 then
        ::dialog1::
        sampShowDialog(13371, '{FFD700}Speed {00FF00}Vehicle', '{FFC000}Настройка скорости машины.\n\nСтандартное значение: {00FF00}1.5\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_vehicle, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13371)
        local res, button, list, input = sampHasDialogRespond(13371)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog1 end
        speed_vehicle = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 2 then
        ::dialog2::
        sampShowDialog(13372, '{FFD700}Speed {00FF00}Passenger', '{FFC000}Настройка скорости пассажира.\n\nСтандартное значение: {00FF00}!!!\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_passenger, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13372)
        local res, button, list, input = sampHasDialogRespond(13372)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog2 end
        speed_passenger = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 3 then
        ::dialog3::
        sampShowDialog(13373, '{FFD700}Speed {00FF00}Player {FF0000}Sync', '{FFC000}Настройка скорости синхронизации персонажа.\n\nСтандартное значение: {00FF00}1.8\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_player_sync, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13373)
        local res, button, list, input = sampHasDialogRespond(13373)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog3 end
        speed_player_sync = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 4 then
        ::dialog4::
        sampShowDialog(13374, '{FFD700}Speed {00FF00}Vehicle {FF0000}Sync', '{FFC000}Настройка скорости синхронизации машины.\n\nСтандартное значение: {00FF00}1.2\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_vehicle_sync, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13374)
        local res, button, list, input = sampHasDialogRespond(13374)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog4 end
        speed_vehicle_sync = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 5 then
        ::dialog5::
        sampShowDialog(13375, '{FFD700}Speed {00FF00}Passenger {FF0000}Sync', '{FFC000}Настройка скорости синхронизации пассажира.\n\nСтандартное значение: {00FF00}0.5\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_passenger_sync, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13375)
        local res, button, list, input = sampHasDialogRespond(13375)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog5 end
        speed_passenger_sync = tonumber(input)
        iniSave()
        messages('Config Save')
    end

end

function intReset()
    inicfg.save({
        NoName = {
            speed_player = 0.76,
            speed_vehicle = 1.5,
            speed_passenger = 0.2,
            speed_player_sync = 1.8,
            speed_vehicle_sync = 1.2,
            speed_passenger_sync = 0.5
        }
    }, 'airbrake_v7')
end

function iniLoad()
    mainIni = inicfg.load(nil, direct)
    if mainIni == nil then
        intReset()
    else
        speed_player = mainIni.NoName.speed_player
        speed_vehicle = mainIni.NoName.speed_vehicle
        speed_passenger = mainIni.NoName.speed_passenger
        speed_player_sync = mainIni.NoName.speed_player_sync
        speed_vehicle_sync = mainIni.NoName.speed_vehicle_sync
        speed_passenger_sync = mainIni.NoName.speed_passenger_sync
    end
end

function iniSave()
    inicfg.save({
        NoName = {
            speed_player = speed_player,
            speed_vehicle = speed_vehicle,
            speed_passenger = speed_passenger,
            speed_player_sync = speed_player_sync,
            speed_vehicle_sync = speed_vehicle_sync,
            speed_passenger_sync = speed_passenger_sync
        }
    }, 'airbrake_v7')
end

function getFullSpeed(speed, ping, min_ping) local fps = require('memory').getfloat(0xB7CB50, true) local result = (speed / (fps / 60)) if ping == 1 then local ping = sampGetPlayerPing(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) if min_ping < ping then result = (result / (min_ping / ping)) end end return result end function onWindowMessage(msg, wparam, lparam) if(msg == 0x100 or msg == 0x101) then if lparam == 3538945 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then airBrkCoords = {getCharCoordinates(PLAYER_PED)} if not isCharInAnyCar(PLAYER_PED) then airBrkCoords[3] = airBrkCoords[3] - 1 end lua_thread.create(airbrake) end end end
 

qdIbp

Автор темы
Проверенный
1,435
1,175
Lua:
script_author('#john')

require 'lib.moonloader'
local keys             = require 'vkeys'
local imgui         = require 'imgui'
local inicfg         = require 'inicfg'
local sampev        = require 'lib.samp.events'
local encoding      = require 'encoding'
encoding.default    = 'CP1251'
u8                  = encoding.UTF8

local tag = '{185aff}[NAT]: {FFFFFF}'

main_window_state = imgui.ImBool(false)

if not doesDirectoryExist('moonloader/config/NemalskAdminTools') then
    createDirectory('moonloader/config/NemalskAdminTools')
end

local mainini = inicfg.load({
config =
{
    share = false,
    wh = false,
    wh_style = 0,
    wh_path = false,
    ab = false,
    ab_playerspeed = 0.76,
    ab_vehiclespeed = 1.5,
    ab_passenger = 0.2,
    ab_syncplayerspeed = 1.8,
    ab_syncvehiclespeed = 1.2,
    ab_syncpassengerspeed = 0.5,
}
}, 'NemalskAdminTools/NemalskAdminTools')

local status = inicfg.load(mainini, 'NemalskAdminTools/NemalskAdminTools.ini')
if not doesFileExist('moonloader/config/NemalskAdminTools/NemalskAdminTools.ini') then
    inicfg.save(mainini, 'NemalskAdminTools/NemalskAdminTools.ini')
end

local share = imgui.ImBool(mainini.config.share)
local wh = imgui.ImBool(mainini.config.wh)
local wh_style = imgui.ImInt(mainini.config.wh_style)
local wh_path = imgui.ImBool(mainini.config.wh_path)
local ab = imgui.ImBool(mainini.config.ab)
local ab_playerspeed = imgui.ImFloat(mainini.config.ab_playerspeed)
local ab_vehiclespeed = imgui.ImFloat(mainini.config.ab_vehiclespeed)
local ab_passenger = imgui.ImFloat(mainini.config.ab_passenger)
local ab_syncplayerspeed = imgui.ImFloat(mainini.config.ab_syncplayerspeed)
local ab_syncvehiclespeed = imgui.ImFloat(mainini.config.ab_syncvehiclespeed)
local ab_syncpassengerspeed = imgui.ImFloat(mainini.config.ab_syncpassengerspeed)

local wh_styles = {
    [1] = u8'WH стиль #1',
    [2] = u8'WH стиль #2'
}

local savefile = 'NemalskAdminTools/NemalskAdminTools.ini'
local airBrkCoords = {}
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampAddChatMessage(tag..'Скрипт {185aff}Nemalsk Admin Tools{FFFFFF} загружен.', -1)
    sampAddChatMessage(tag..'Настройки скрипта: "{185aff}/nat{FFFFFF}".', -1)
    sampAddChatMessage(tag..'Автор скрипта {185aff}#gonzales(Roy Gonzales){FFFFFF}, мне очень приятно что ты используешь мой скрипт :D', -1)

    sampRegisterChatCommand('nat', function()
        main_window_state.v = not main_window_state.v
        imgui.Process = main_window_state.v
    end)

    _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)
    
    imgui.Process = false
    font = renderCreateFont("Arial", 10, 5)
    while true do wait(0)
        imgui.Process = main_window_state.v
        if ab.v then
            airBrkCoords = {getCharCoordinates(PLAYER_PED)}
            print(airBrkCoords[1])
            airbrake()
        end
        if wh.v then
            for id = 0, sampGetMaxPlayerId(true)
            do
                if sampIsPlayerConnected(id) then
                    local exists, handle = sampGetCharHandleBySampPlayerId(id)
                        if exists and doesCharExist(handle) then
                            if isCharOnScreen(handle) then

                            local color = sampGetPlayerColor(id)
                            local name = sampGetPlayerNickname(id)
                            local health = sampGetPlayerHealth(id)
                            local armor = sampGetPlayerArmor(id)
                            local weapon = getCurrentCharWeapon(handle)
                            local weap = getweaponname(weapon)
                            local ping = sampGetPlayerPing(id)
                            local X, Y, Z = getCharCoordinates(handle)
                            local x, y = convert3DCoordsToScreen(X, Y, Z)
                            local myX, myY, myZ = getCharCoordinates(playerPed)
                            local myx, myy = convert3DCoordsToScreen(myX, myY, myZ)
                            local distance = getDistanceBetweenCoords3d(X, Y, Z, myX, myY, myZ)
                            local model = getCharModel(handle)

                            if mainini.config.wh_style == 0 then
                                if not sampIsPlayerPaused(id) then
                                    renderFontDrawText(font, string.format("%s[%d]", name, id), x, y, color)
                                else
                                    renderFontDrawText(font, string.format("%s[%d] (AFK)", name, id), x, y, color)
                                end
                            end

                            distance = math.ceil(distance)
                            if mainini.config.wh_style == 1 then
                                if not sampIsPlayerPaused(id) then
                                    renderFontDrawText(font, string.format("%s[%d]\n%d HP | %d AP\nPing: %d\nWeapon: %s\nDistance: %d", name, id, health, armor, ping, weap, distance), x, y, color)
                                else
                                    renderFontDrawText(font, string.format("%s[%d] (AFK)\n%d HP | %d AP\nPing: %d\nWeapon: %s\nDistance: %d", name, id, health, armor, ping, weap, distance), x, y, color)
                                end
                            end

                            if wh_path.v then
                                renderDrawLine(myx, myy, x, y, 2, color)
                                renderDrawPolygon(x, y, 5, 5, 15, 0, color)
                            end
                        end
                    end
                end
            end
        end   
    end
end

function imgui.OnDrawFrame()
    if not main_window_state.v then
        imgui.Process = false
    end
    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(800, 400), imgui.Cond.FirstUseEver)
        imgui.Begin('Renaissance Helper ', main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoSavedSettings)
            if not menu then menu = 1 end
            imgui.BeginChild('#Menu', imgui.ImVec2(150, 365), true)
                if imgui.Button(u8'Настройки',imgui.ImVec2(134, 50)) then
                    menu = 1
                end
                if imgui.Button(u8'Авто. доклад',imgui.ImVec2(134, 50)) then
                    menu = 2
                end
                if imgui.Button(u8'Автор',imgui.ImVec2(134, 50)) then
                    menu = 3
                end
            imgui.EndChild()

            imgui.SameLine()

            imgui.BeginChild('#Desktop', imgui.ImVec2(629, 365), true)
                if menu == 1 then

                    if imgui.Checkbox(u8'Акциент администратора', share) then
                        mainini.config.share = share.v
                        inicfg.save(mainini, savefile)
                    end   

                    imgui.Separator()
                    
                    imgui.CenterTextColoredRGB('Читы для администрации')
                    
                    imgui.Separator()
                    
                    if imgui.Checkbox(u8'WH', wh) then
                        mainini.config.wh = wh.v
                        inicfg.save(mainini, savefile)
                    end   
                    
                    if wh.v then
                        imgui.SameLine()
                        imgui.SetCursorPosX(350)
                        imgui.BeginChild('#WH.V', imgui.ImVec2(273, 35), true)
                            if imgui.Checkbox(u8'WH path', wh_path) then
                                mainini.config.wh_path = wh_path.v
                                inicfg.save(mainini, savefile)
                            end   
                            
                            imgui.SameLine()
                            imgui.SetCursorPosX(117)
                            imgui.PushItemWidth(150)
                            if imgui.Combo('##WH_STYLES', wh_style, wh_styles) then
                                mainini.config.wh_style = wh_style.v
                                inicfg.save(mainini, savefile)
                            end
                            imgui.PopItemWidth()
                        imgui.EndChild()       
                    end
                        
                    if imgui.Checkbox(u8'AirBrake', ab) then
                        mainini.config.ab = ab.v
                        inicfg.save(mainini, savefile)
                    end   
                    
                    if ab.v then
                        imgui.SameLine()
                        imgui.SetCursorPosX(350)
                        imgui.BeginChild('#AB.V', imgui.ImVec2(273, 100), true)
                            imgui.PushItemWidth(250)
                                if imgui.SliderFloat('##ab_playerspeed', ab_playerspeed, 0, 3, u8'%0.02f - скорость игрока') then
                                    mainini.config.ab_playerspeed = ab_playerspeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_vehiclespeed', ab_vehiclespeed, 0, 3, u8'%0.02f - скорость транспорта') then
                                    mainini.config.ab_vehiclespeed = ab_vehiclespeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_passenger', ab_passenger, 0, 3, u8'%0.02f - сколько пассажира') then
                                    mainini.config.ab_passenger = ab_passenger.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_syncpassengerspeed', ab_syncpassengerspeed, 0, 3, u8'%0.02f - скорсть sync пассажира') then
                                    mainini.config.ab_syncpassengerspeed = ab_syncpassengerspeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_syncplayerspeed', ab_syncplayerspeed, 0, 3, u8'%0.02f - скорсть sync игрока') then
                                    mainini.config.ab_syncplayerspeed = ab_syncplayerspeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_syncvehiclespeed', ab_syncvehiclespeed, 0, 3, u8'%0.02f - скорсть sync транспорта') then
                                    mainini.config.ab_syncvehiclespeed = ab_syncvehiclespeed.v
                                    inicfg.save(mainini, savefile)
                                end
                            imgui.PopItemWidth()
                        imgui.EndChild()
                    end   
                end
                if menu == 2 then
                    
                end
                if menu == 3 then
                    if imgui.Button(u8'Форумный аккаунт разработчика ',imgui.ImVec2(612, 30)) then
                        os.execute('explorer https://forum-nemalsk-rp.tk/members/roy_gonzales.412/')
                    end
                    if imgui.Button(u8'Вконакте разработчика ',imgui.ImVec2(612, 30)) then
                        os.execute('explorer https://vk.com/n.ermak_play')
                    end

                    imgui.Separator()

                    imgui.CenterTextColoredRGB('Версия скрипта: {FF0000}1.0')
                end
            imgui.EndChild()
        imgui.End()
    end
end

function airbrake()
    if ab.v then
        while ab.v do wait(0)

            if isCharInAnyCar(PLAYER_PED) then setCarHeading(getCarCharIsUsing(PLAYER_PED), getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) if getDriverOfCar(getCarCharIsUsing(PLAYER_PED)) == -1 then speed = getFullSpeed(ab_passenger.v, 0, 0) else speed = getFullSpeed(ab_vehiclespeed, 0, 0) end else speed = getFullSpeed(ab_playerspeed.v, 0, 0) setCharHeading(PLAYER_PED, getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) end
            if sampIsCursorActive() then goto mark end
            if isKeyDown(VK_SPACE) then airBrkCoords[3] = airBrkCoords[3] + speed / 2 elseif isKeyDown(VK_LSHIFT) and airBrkCoords[3] > -95.0 then airBrkCoords[3] = airBrkCoords[3] - speed / 2 end
            if isKeyDown(VK_W) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) elseif isKeyDown(VK_S) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) end
            if isKeyDown(VK_A) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) elseif isKeyDown(VK_D) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) end

            ::mark::
            setCharCoordinates(PLAYER_PED, airBrkCoords[1], airBrkCoords[2], airBrkCoords[3])

        end
    end   
end

function sampev.onSendPlayerSync(data)
    if not active then return end
        local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncplayerspeed.v)
        data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendVehicleSync(data)
    if not active then return end
        local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncvehiclespeed)
        data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendUnoccupiedSync(data)
    if not active then return end
        local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncpassengerspeed)
        data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendPassengerSync(data)
    if not active then return end
        pcall(onSendUnoccupiedSync, data.vehicleId, data.seatId)
        data.position = {getCharCoordinates(PLAYER_PED)}
    return data
end

function getMoveSpeed(heading, speed)
    moveSpeed = {x = math.sin(-math.rad(heading)) * (speed), y = math.cos(-math.rad(heading)) * (speed), z = 0}
    return moveSpeed
end


function getFullSpeed(speed, ping, min_ping)
    local fps = require('memory').getfloat(0xB7CB50, true)
    local result = (speed / (fps / 60))
    if ping == 1 then
        local ping = sampGetPlayerPing(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))
        if min_ping < ping then
            result = (result / (min_ping / ping))
        end
    end
    return result
end

function onWindowMessage(msg, wparam, lparam)
    if(msg == 0x100 or msg == 0x101) then
        if lparam == 3538945 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then
            if not isCharInAnyCar(PLAYER_PED) then
                airBrkCoords[3] = airBrkCoords[3] - 1
            end
        end
    end
end

function getweaponname(weapon)
    local names = {
        [0] = "Fist",
        [1] = "Brass Knuckles",
        [2] = "Golf Club",
        [3] = "Nightstick",
        [4] = "Knife",
        [5] = "Baseball Bat",
        [6] = "Shovel",
        [7] = "Pool Cue",
        [8] = "Katana",
        [9] = "Chainsaw",
        [10] = "Purple Dildo",
        [11] = "Dildo",
        [12] = "Vibrator",
        [13] = "Silver Vibrator",
        [14] = "Flowers",
        [15] = "Cane",
        [16] = "Grenade",
        [17] = "Tear Gas",
        [18] = "Molotov Cocktail",
        [22] = "9mm",
        [23] = "Silenced 9mm",
        [24] = "Desert Eagle",
        [25] = "Shotgun",
        [26] = "Sawnoff Shotgun",
        [27] = "Combat Shotgun",
        [28] = "Micro SMG/Uzi",
        [29] = "MP5",
        [30] = "AK-47",
        [31] = "M4",
        [32] = "Tec-9",
        [33] = "Country Rifle",
        [34] = "Sniper Rifle",
        [35] = "RPG",
        [36] = "HS Rocket",
        [37] = "Flamethrower",
        [38] = "Minigun",
        [39] = "Satchel Charge",
        [40] = "Detonator",
        [41] = "Spraycan",
        [42] = "Fire Extinguisher",
        [43] = "Camera",
        [44] = "Night Vis Goggles",
        [45] = "Thermal Goggles",
        [46] = "Parachute"
    }
    return names[weapon]
end

function imgui.VerticalSeparator()
    local p = imgui.GetCursorScreenPos()
    imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y), imgui.ImVec2(p.x, p.y + imgui.GetContentRegionMax().y), imgui.GetColorU32(imgui.GetStyle().Colors[imgui.Col.Separator]))
end

function sampev.onSendChat(message, msg)
    if share.v then
        if message == ')' or message == '(' or message ==  '))' or message == '((' or message == 'xD' or message == ':D' or message == ':d' or message == 'XD' then return{message} end
        return{'[A]: '..message}
    end
    if msg:find('{sex:%A+|%A+}') then
        local male, female = msg:match('{sex:(%A+)|(%A+)}')
        if mainini.config.sex == 0 then
            local returnMsg = msg:gsub('{sex:%A+|%A+}', male, 1)
            sampSendChat(tostring(returnMsg))
            return false
            else
            local returnMsg = msg:gsub('{sex:%A+|%A+}', female, 1)
            sampSendChat(tostring(returnMsg))
            return false
        end
    end
end

function imgui.CenterTextColoredRGB(text)
    local width = imgui.GetWindowWidth()
    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 textsize = w:gsub('{.-}', '')
    local text_width = imgui.CalcTextSize(u8(textsize))
    imgui.SetCursorPosX( width / 2 - text_width .x / 2 )
    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

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

function theme()
    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

    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.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.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
    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.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.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.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
end
theme()

Вроде как исправил хуйню которая была нагорожена с airbrake`ом
 

SunRays

Новичок
Автор темы
12
0
Lua:
script_author('#john')

require 'lib.moonloader'
local keys             = require 'vkeys'
local imgui         = require 'imgui'
local inicfg         = require 'inicfg'
local sampev        = require 'lib.samp.events'
local encoding      = require 'encoding'
encoding.default    = 'CP1251'
u8                  = encoding.UTF8

local tag = '{185aff}[NAT]: {FFFFFF}'

main_window_state = imgui.ImBool(false)

if not doesDirectoryExist('moonloader/config/NemalskAdminTools') then
    createDirectory('moonloader/config/NemalskAdminTools')
end

local mainini = inicfg.load({
config =
{
    share = false,
    wh = false,
    wh_style = 0,
    wh_path = false,
    ab = false,
    ab_playerspeed = 0.76,
    ab_vehiclespeed = 1.5,
    ab_passenger = 0.2,
    ab_syncplayerspeed = 1.8,
    ab_syncvehiclespeed = 1.2,
    ab_syncpassengerspeed = 0.5,
}
}, 'NemalskAdminTools/NemalskAdminTools')

local status = inicfg.load(mainini, 'NemalskAdminTools/NemalskAdminTools.ini')
if not doesFileExist('moonloader/config/NemalskAdminTools/NemalskAdminTools.ini') then
    inicfg.save(mainini, 'NemalskAdminTools/NemalskAdminTools.ini')
end

local share = imgui.ImBool(mainini.config.share)
local wh = imgui.ImBool(mainini.config.wh)
local wh_style = imgui.ImInt(mainini.config.wh_style)
local wh_path = imgui.ImBool(mainini.config.wh_path)
local ab = imgui.ImBool(mainini.config.ab)
local ab_playerspeed = imgui.ImFloat(mainini.config.ab_playerspeed)
local ab_vehiclespeed = imgui.ImFloat(mainini.config.ab_vehiclespeed)
local ab_passenger = imgui.ImFloat(mainini.config.ab_passenger)
local ab_syncplayerspeed = imgui.ImFloat(mainini.config.ab_syncplayerspeed)
local ab_syncvehiclespeed = imgui.ImFloat(mainini.config.ab_syncvehiclespeed)
local ab_syncpassengerspeed = imgui.ImFloat(mainini.config.ab_syncpassengerspeed)

local wh_styles = {
    [1] = u8'WH стиль #1',
    [2] = u8'WH стиль #2'
}

local savefile = 'NemalskAdminTools/NemalskAdminTools.ini'
local airBrkCoords = {}
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampAddChatMessage(tag..'Скрипт {185aff}Nemalsk Admin Tools{FFFFFF} загружен.', -1)
    sampAddChatMessage(tag..'Настройки скрипта: "{185aff}/nat{FFFFFF}".', -1)
    sampAddChatMessage(tag..'Автор скрипта {185aff}#gonzales(Roy Gonzales){FFFFFF}, мне очень приятно что ты используешь мой скрипт :D', -1)

    sampRegisterChatCommand('nat', function()
        main_window_state.v = not main_window_state.v
        imgui.Process = main_window_state.v
    end)

    _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)
   
    imgui.Process = false
    font = renderCreateFont("Arial", 10, 5)
    while true do wait(0)
        imgui.Process = main_window_state.v
        if ab.v then
            airBrkCoords = {getCharCoordinates(PLAYER_PED)}
            print(airBrkCoords[1])
            airbrake()
        end
        if wh.v then
            for id = 0, sampGetMaxPlayerId(true)
            do
                if sampIsPlayerConnected(id) then
                    local exists, handle = sampGetCharHandleBySampPlayerId(id)
                        if exists and doesCharExist(handle) then
                            if isCharOnScreen(handle) then

                            local color = sampGetPlayerColor(id)
                            local name = sampGetPlayerNickname(id)
                            local health = sampGetPlayerHealth(id)
                            local armor = sampGetPlayerArmor(id)
                            local weapon = getCurrentCharWeapon(handle)
                            local weap = getweaponname(weapon)
                            local ping = sampGetPlayerPing(id)
                            local X, Y, Z = getCharCoordinates(handle)
                            local x, y = convert3DCoordsToScreen(X, Y, Z)
                            local myX, myY, myZ = getCharCoordinates(playerPed)
                            local myx, myy = convert3DCoordsToScreen(myX, myY, myZ)
                            local distance = getDistanceBetweenCoords3d(X, Y, Z, myX, myY, myZ)
                            local model = getCharModel(handle)

                            if mainini.config.wh_style == 0 then
                                if not sampIsPlayerPaused(id) then
                                    renderFontDrawText(font, string.format("%s[%d]", name, id), x, y, color)
                                else
                                    renderFontDrawText(font, string.format("%s[%d] (AFK)", name, id), x, y, color)
                                end
                            end

                            distance = math.ceil(distance)
                            if mainini.config.wh_style == 1 then
                                if not sampIsPlayerPaused(id) then
                                    renderFontDrawText(font, string.format("%s[%d]\n%d HP | %d AP\nPing: %d\nWeapon: %s\nDistance: %d", name, id, health, armor, ping, weap, distance), x, y, color)
                                else
                                    renderFontDrawText(font, string.format("%s[%d] (AFK)\n%d HP | %d AP\nPing: %d\nWeapon: %s\nDistance: %d", name, id, health, armor, ping, weap, distance), x, y, color)
                                end
                            end

                            if wh_path.v then
                                renderDrawLine(myx, myy, x, y, 2, color)
                                renderDrawPolygon(x, y, 5, 5, 15, 0, color)
                            end
                        end
                    end
                end
            end
        end  
    end
end

function imgui.OnDrawFrame()
    if not main_window_state.v then
        imgui.Process = false
    end
    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(800, 400), imgui.Cond.FirstUseEver)
        imgui.Begin('Renaissance Helper ', main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoSavedSettings)
            if not menu then menu = 1 end
            imgui.BeginChild('#Menu', imgui.ImVec2(150, 365), true)
                if imgui.Button(u8'Настройки',imgui.ImVec2(134, 50)) then
                    menu = 1
                end
                if imgui.Button(u8'Авто. доклад',imgui.ImVec2(134, 50)) then
                    menu = 2
                end
                if imgui.Button(u8'Автор',imgui.ImVec2(134, 50)) then
                    menu = 3
                end
            imgui.EndChild()

            imgui.SameLine()

            imgui.BeginChild('#Desktop', imgui.ImVec2(629, 365), true)
                if menu == 1 then

                    if imgui.Checkbox(u8'Акциент администратора', share) then
                        mainini.config.share = share.v
                        inicfg.save(mainini, savefile)
                    end  

                    imgui.Separator()
                   
                    imgui.CenterTextColoredRGB('Читы для администрации')
                   
                    imgui.Separator()
                   
                    if imgui.Checkbox(u8'WH', wh) then
                        mainini.config.wh = wh.v
                        inicfg.save(mainini, savefile)
                    end  
                   
                    if wh.v then
                        imgui.SameLine()
                        imgui.SetCursorPosX(350)
                        imgui.BeginChild('#WH.V', imgui.ImVec2(273, 35), true)
                            if imgui.Checkbox(u8'WH path', wh_path) then
                                mainini.config.wh_path = wh_path.v
                                inicfg.save(mainini, savefile)
                            end  
                           
                            imgui.SameLine()
                            imgui.SetCursorPosX(117)
                            imgui.PushItemWidth(150)
                            if imgui.Combo('##WH_STYLES', wh_style, wh_styles) then
                                mainini.config.wh_style = wh_style.v
                                inicfg.save(mainini, savefile)
                            end
                            imgui.PopItemWidth()
                        imgui.EndChild()      
                    end
                       
                    if imgui.Checkbox(u8'AirBrake', ab) then
                        mainini.config.ab = ab.v
                        inicfg.save(mainini, savefile)
                    end  
                   
                    if ab.v then
                        imgui.SameLine()
                        imgui.SetCursorPosX(350)
                        imgui.BeginChild('#AB.V', imgui.ImVec2(273, 100), true)
                            imgui.PushItemWidth(250)
                                if imgui.SliderFloat('##ab_playerspeed', ab_playerspeed, 0, 3, u8'%0.02f - скорость игрока') then
                                    mainini.config.ab_playerspeed = ab_playerspeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_vehiclespeed', ab_vehiclespeed, 0, 3, u8'%0.02f - скорость транспорта') then
                                    mainini.config.ab_vehiclespeed = ab_vehiclespeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_passenger', ab_passenger, 0, 3, u8'%0.02f - сколько пассажира') then
                                    mainini.config.ab_passenger = ab_passenger.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_syncpassengerspeed', ab_syncpassengerspeed, 0, 3, u8'%0.02f - скорсть sync пассажира') then
                                    mainini.config.ab_syncpassengerspeed = ab_syncpassengerspeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_syncplayerspeed', ab_syncplayerspeed, 0, 3, u8'%0.02f - скорсть sync игрока') then
                                    mainini.config.ab_syncplayerspeed = ab_syncplayerspeed.v
                                    inicfg.save(mainini, savefile)
                                end
                                if imgui.SliderFloat('##ab_syncvehiclespeed', ab_syncvehiclespeed, 0, 3, u8'%0.02f - скорсть sync транспорта') then
                                    mainini.config.ab_syncvehiclespeed = ab_syncvehiclespeed.v
                                    inicfg.save(mainini, savefile)
                                end
                            imgui.PopItemWidth()
                        imgui.EndChild()
                    end  
                end
                if menu == 2 then
                   
                end
                if menu == 3 then
                    if imgui.Button(u8'Форумный аккаунт разработчика ',imgui.ImVec2(612, 30)) then
                        os.execute('explorer https://forum-nemalsk-rp.tk/members/roy_gonzales.412/')
                    end
                    if imgui.Button(u8'Вконакте разработчика ',imgui.ImVec2(612, 30)) then
                        os.execute('explorer https://vk.com/n.ermak_play')
                    end

                    imgui.Separator()

                    imgui.CenterTextColoredRGB('Версия скрипта: {FF0000}1.0')
                end
            imgui.EndChild()
        imgui.End()
    end
end

function airbrake()
    if ab.v then
        while ab.v do wait(0)

            if isCharInAnyCar(PLAYER_PED) then setCarHeading(getCarCharIsUsing(PLAYER_PED), getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) if getDriverOfCar(getCarCharIsUsing(PLAYER_PED)) == -1 then speed = getFullSpeed(ab_passenger.v, 0, 0) else speed = getFullSpeed(ab_vehiclespeed, 0, 0) end else speed = getFullSpeed(ab_playerspeed.v, 0, 0) setCharHeading(PLAYER_PED, getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) end
            if sampIsCursorActive() then goto mark end
            if isKeyDown(VK_SPACE) then airBrkCoords[3] = airBrkCoords[3] + speed / 2 elseif isKeyDown(VK_LSHIFT) and airBrkCoords[3] > -95.0 then airBrkCoords[3] = airBrkCoords[3] - speed / 2 end
            if isKeyDown(VK_W) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) elseif isKeyDown(VK_S) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) end
            if isKeyDown(VK_A) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) elseif isKeyDown(VK_D) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) end

            ::mark::
            setCharCoordinates(PLAYER_PED, airBrkCoords[1], airBrkCoords[2], airBrkCoords[3])

        end
    end  
end

function sampev.onSendPlayerSync(data)
    if not active then return end
        local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncplayerspeed.v)
        data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendVehicleSync(data)
    if not active then return end
        local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncvehiclespeed)
        data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendUnoccupiedSync(data)
    if not active then return end
        local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), ab_syncpassengerspeed)
        data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendPassengerSync(data)
    if not active then return end
        pcall(onSendUnoccupiedSync, data.vehicleId, data.seatId)
        data.position = {getCharCoordinates(PLAYER_PED)}
    return data
end

function getMoveSpeed(heading, speed)
    moveSpeed = {x = math.sin(-math.rad(heading)) * (speed), y = math.cos(-math.rad(heading)) * (speed), z = 0}
    return moveSpeed
end


function getFullSpeed(speed, ping, min_ping)
    local fps = require('memory').getfloat(0xB7CB50, true)
    local result = (speed / (fps / 60))
    if ping == 1 then
        local ping = sampGetPlayerPing(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))
        if min_ping < ping then
            result = (result / (min_ping / ping))
        end
    end
    return result
end

function onWindowMessage(msg, wparam, lparam)
    if(msg == 0x100 or msg == 0x101) then
        if lparam == 3538945 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then
            if not isCharInAnyCar(PLAYER_PED) then
                airBrkCoords[3] = airBrkCoords[3] - 1
            end
        end
    end
end

function getweaponname(weapon)
    local names = {
        [0] = "Fist",
        [1] = "Brass Knuckles",
        [2] = "Golf Club",
        [3] = "Nightstick",
        [4] = "Knife",
        [5] = "Baseball Bat",
        [6] = "Shovel",
        [7] = "Pool Cue",
        [8] = "Katana",
        [9] = "Chainsaw",
        [10] = "Purple Dildo",
        [11] = "Dildo",
        [12] = "Vibrator",
        [13] = "Silver Vibrator",
        [14] = "Flowers",
        [15] = "Cane",
        [16] = "Grenade",
        [17] = "Tear Gas",
        [18] = "Molotov Cocktail",
        [22] = "9mm",
        [23] = "Silenced 9mm",
        [24] = "Desert Eagle",
        [25] = "Shotgun",
        [26] = "Sawnoff Shotgun",
        [27] = "Combat Shotgun",
        [28] = "Micro SMG/Uzi",
        [29] = "MP5",
        [30] = "AK-47",
        [31] = "M4",
        [32] = "Tec-9",
        [33] = "Country Rifle",
        [34] = "Sniper Rifle",
        [35] = "RPG",
        [36] = "HS Rocket",
        [37] = "Flamethrower",
        [38] = "Minigun",
        [39] = "Satchel Charge",
        [40] = "Detonator",
        [41] = "Spraycan",
        [42] = "Fire Extinguisher",
        [43] = "Camera",
        [44] = "Night Vis Goggles",
        [45] = "Thermal Goggles",
        [46] = "Parachute"
    }
    return names[weapon]
end

function imgui.VerticalSeparator()
    local p = imgui.GetCursorScreenPos()
    imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y), imgui.ImVec2(p.x, p.y + imgui.GetContentRegionMax().y), imgui.GetColorU32(imgui.GetStyle().Colors[imgui.Col.Separator]))
end

function sampev.onSendChat(message, msg)
    if share.v then
        if message == ')' or message == '(' or message ==  '))' or message == '((' or message == 'xD' or message == ':D' or message == ':d' or message == 'XD' then return{message} end
        return{'[A]: '..message}
    end
    if msg:find('{sex:%A+|%A+}') then
        local male, female = msg:match('{sex:(%A+)|(%A+)}')
        if mainini.config.sex == 0 then
            local returnMsg = msg:gsub('{sex:%A+|%A+}', male, 1)
            sampSendChat(tostring(returnMsg))
            return false
            else
            local returnMsg = msg:gsub('{sex:%A+|%A+}', female, 1)
            sampSendChat(tostring(returnMsg))
            return false
        end
    end
end

function imgui.CenterTextColoredRGB(text)
    local width = imgui.GetWindowWidth()
    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 textsize = w:gsub('{.-}', '')
    local text_width = imgui.CalcTextSize(u8(textsize))
    imgui.SetCursorPosX( width / 2 - text_width .x / 2 )
    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

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

function theme()
    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

    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.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.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
    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.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.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.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
end
theme()

Вроде как исправил хуйню которая была нагорожена с airbrake`ом
Уже исправил другим способом, но спасибо за помощь
 
  • Грустно
Реакции: qdIbp

whyega52

Гений, миллионер, плейбой, долбаеб
Модератор
2,782
2,609
Хз, делал всё также как в другом скрипте.

скрипт откуда взял аир:
script_author('https://www.blast.hk/members/117882/')
script_name('AirBrake.v7')

local sampev = require('lib.samp.events')
local inicfg = require('inicfg')

require"lib.moonloader"
require"lib.sampfuncs"

local direct = 'moonloader\\config\\airbrake_v7.ini'

local function messages(text)
    sampAddChatMessage('{FFFFFF}[{00DD00}AirBrake.V7{FFFFFF}] - {FFC000}'..tostring(text), 0x4B0082)
end

function main() if not isSampfuncsLoaded() or not isSampLoaded() then return end repeat wait(0) until isSampAvailable() messages('Автор: 00DD00 & || NN - NoName ||') iniLoad() sampRegisterChatCommand('airbrake', function() lua_thread.create(set) end) wait(-1) end

function airbrake()
    active = not active
    printStringNow(active and '~S~Air~P~Brake ~B~Activated~N~~R~Author: ~G~00DD00 | NN - NoName' or '~S~Air~P~Brake ~B~De-Activated~N~~R~Author: ~G~00DD00 | NN - NoName', 5000)
    if not active then return end
    while active do wait(0)

        if isCharInAnyCar(PLAYER_PED) then setCarHeading(getCarCharIsUsing(PLAYER_PED), getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) if getDriverOfCar(getCarCharIsUsing(PLAYER_PED)) == -1 then speed = getFullSpeed(speed_passenger, 0, 0) else speed = getFullSpeed(speed_vehicle, 0, 0) end else speed = getFullSpeed(speed_player, 0, 0) setCharHeading(PLAYER_PED, getHeadingFromVector2d(select(1, getActiveCameraPointAt()) - select(1, getActiveCameraCoordinates()), select(2, getActiveCameraPointAt()) - select(2, getActiveCameraCoordinates()))) end

        if sampIsCursorActive() then goto mark end

        if isKeyDown(VK_SPACE) then airBrkCoords[3] = airBrkCoords[3] + speed / 2 elseif isKeyDown(VK_LSHIFT) and airBrkCoords[3] > -95.0 then airBrkCoords[3] = airBrkCoords[3] - speed / 2 end

        if isKeyDown(VK_W) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) elseif isKeyDown(VK_S) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED))) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED))) end
        if isKeyDown(VK_A) then airBrkCoords[1] = airBrkCoords[1] - speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] - speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) elseif isKeyDown(VK_D) then airBrkCoords[1] = airBrkCoords[1] + speed * math.sin(-math.rad(getCharHeading(PLAYER_PED) - 90)) airBrkCoords[2] = airBrkCoords[2] + speed * math.cos(-math.rad(getCharHeading(PLAYER_PED) - 90)) end

        ::mark::
        setCharCoordinates(PLAYER_PED, airBrkCoords[1], airBrkCoords[2], airBrkCoords[3])

    end
end

function sampev.onSendPlayerSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), speed_player_sync)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendVehicleSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), speed_vehicle_sync)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendUnoccupiedSync(data)
    if not active then return end

    local fuck = getMoveSpeed(getCharHeading(PLAYER_PED), speed_passenger_sync)
    data.moveSpeed = {fuck.x, fuck.y, data.moveSpeed.z}
    return data
end

function sampev.onSendPassengerSync(data)
    if not active then return end

    pcall(onSendUnoccupiedSync, data.vehicleId, data.seatId)
    data.position = {getCharCoordinates(PLAYER_PED)}
    return data
end

function getMoveSpeed(heading, speed)
    moveSpeed = {x = math.sin(-math.rad(heading)) * (speed), y = math.cos(-math.rad(heading)) * (speed), z = 0}
    return moveSpeed
end

function set()

    -- Да-да, я знаю что использовать такую хуйню как внизу, это говнокод. Но мне так было легче, так что пошли на хуй.

    local m_set = {
        {'Скорость персонажа', speed_player},
        {'Скорость машины', speed_vehicle},
        {'Скорость пассажира', speed_passenger},
        {'Скорость синхры персонажа', speed_player_sync},
        {'Скорость синхры машины', speed_vehicle_sync},
        {'Скорость синхры пассажира', speed_passenger_sync}
    }

    local text = nil

    for i = 1, #m_set do if text == nil then text = '{00DD00}Наименование\t{FFC000}Значение\n{FFC000}'..m_set[i][1]..'\t{00DD00}'..m_set[i][2]..'\n' else text = text..'{FFC000}'..m_set[i][1]..'\t{00DD00}'..m_set[i][2]..'\n' end end

    ::dialog::
    sampShowDialog(1337228, '{00FF00}Air{FFD700}Brake {FF00FF}V7', text, '{00DD00}Next', '{FF0000}Exit', 5)
    repeat wait(0) until not sampIsDialogActive(1337228)
    local res, button, list, input = sampHasDialogRespond(1337228)
    if button ~= 1 then return end
   
    if list == 0 then
        ::dialog0::
        sampShowDialog(1337, '{FFD700}Speed {00FF00}Player', '{FFC000}Настройка скорости персонажа.\n\nСтандартное значение: {00FF00}0.76\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_player, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(1337)
        local res, button, list, input = sampHasDialogRespond(1337)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog0 end
        speed_player = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 1 then
        ::dialog1::
        sampShowDialog(13371, '{FFD700}Speed {00FF00}Vehicle', '{FFC000}Настройка скорости машины.\n\nСтандартное значение: {00FF00}1.5\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_vehicle, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13371)
        local res, button, list, input = sampHasDialogRespond(13371)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog1 end
        speed_vehicle = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 2 then
        ::dialog2::
        sampShowDialog(13372, '{FFD700}Speed {00FF00}Passenger', '{FFC000}Настройка скорости пассажира.\n\nСтандартное значение: {00FF00}!!!\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_passenger, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13372)
        local res, button, list, input = sampHasDialogRespond(13372)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog2 end
        speed_passenger = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 3 then
        ::dialog3::
        sampShowDialog(13373, '{FFD700}Speed {00FF00}Player {FF0000}Sync', '{FFC000}Настройка скорости синхронизации персонажа.\n\nСтандартное значение: {00FF00}1.8\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_player_sync, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13373)
        local res, button, list, input = sampHasDialogRespond(13373)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog3 end
        speed_player_sync = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 4 then
        ::dialog4::
        sampShowDialog(13374, '{FFD700}Speed {00FF00}Vehicle {FF0000}Sync', '{FFC000}Настройка скорости синхронизации машины.\n\nСтандартное значение: {00FF00}1.2\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_vehicle_sync, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13374)
        local res, button, list, input = sampHasDialogRespond(13374)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog4 end
        speed_vehicle_sync = tonumber(input)
        iniSave()
        messages('Config Save')
    elseif list == 5 then
        ::dialog5::
        sampShowDialog(13375, '{FFD700}Speed {00FF00}Passenger {FF0000}Sync', '{FFC000}Настройка скорости синхронизации пассажира.\n\nСтандартное значение: {00FF00}0.5\n\n{FFC000}Значение в данный момент: {00FF00}'..speed_passenger_sync, '{00DD00}Save', '{FF0000}Exit', 1)
        repeat wait(0) until not sampIsDialogActive(13375)
        local res, button, list, input = sampHasDialogRespond(13375)
        if button ~= 1 then goto dialog end
        if input == '' or tonumber(input) == nil then messages('Значение введено не верно.') goto dialog5 end
        speed_passenger_sync = tonumber(input)
        iniSave()
        messages('Config Save')
    end

end

function intReset()
    inicfg.save({
        NoName = {
            speed_player = 0.76,
            speed_vehicle = 1.5,
            speed_passenger = 0.2,
            speed_player_sync = 1.8,
            speed_vehicle_sync = 1.2,
            speed_passenger_sync = 0.5
        }
    }, 'airbrake_v7')
end

function iniLoad()
    mainIni = inicfg.load(nil, direct)
    if mainIni == nil then
        intReset()
    else
        speed_player = mainIni.NoName.speed_player
        speed_vehicle = mainIni.NoName.speed_vehicle
        speed_passenger = mainIni.NoName.speed_passenger
        speed_player_sync = mainIni.NoName.speed_player_sync
        speed_vehicle_sync = mainIni.NoName.speed_vehicle_sync
        speed_passenger_sync = mainIni.NoName.speed_passenger_sync
    end
end

function iniSave()
    inicfg.save({
        NoName = {
            speed_player = speed_player,
            speed_vehicle = speed_vehicle,
            speed_passenger = speed_passenger,
            speed_player_sync = speed_player_sync,
            speed_vehicle_sync = speed_vehicle_sync,
            speed_passenger_sync = speed_passenger_sync
        }
    }, 'airbrake_v7')
end

function getFullSpeed(speed, ping, min_ping) local fps = require('memory').getfloat(0xB7CB50, true) local result = (speed / (fps / 60)) if ping == 1 then local ping = sampGetPlayerPing(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) if min_ping < ping then result = (result / (min_ping / ping)) end end return result end function onWindowMessage(msg, wparam, lparam) if(msg == 0x100 or msg == 0x101) then if lparam == 3538945 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then airBrkCoords = {getCharCoordinates(PLAYER_PED)} if not isCharInAnyCar(PLAYER_PED) then airBrkCoords[3] = airBrkCoords[3] - 1 end lua_thread.create(airbrake) end end end
А разве есть локальные функции?
 

chapo

чопа сребдс // @moujeek
Модератор
8,868
11,575
А разве есть локальные функции?
да. Скажу даже больше, функция это по сути переменная, так что можно делать даже
Lua:
main = function() —кста если перед main написать local то функция не запустится при загрузке скрипта

end
 
  • Нравится
Реакции: whyega52 и ARMOR

whyega52

Гений, миллионер, плейбой, долбаеб
Модератор
2,782
2,609
да. Скажу даже больше, функция это по сути переменная, так что можно делать даже
Lua:
main = function() —кста если перед main написать local то функция не запустится при загрузке скрипта

end
А чем отличается локальная функция от глобальной?

А чем отличается локальная функция от глобальной?
Типа можно создать функцию, которая будет работать только в функции, где была создана?