помогите с скриптом

s0gg

Участник
Автор темы
35
3
Версия MoonLoader
.026-beta
помогите с скриптом, мне надо чтоб у меня в имгуи біл слайдер, которій отвечает за радиус роботі вот код:


Lua:
require('lib.moonloader')
local imgui = require('lib.imgui')
local sampev = require('lib.samp.events')
local huy = '[Silent aim]: '
local missRatio = imgui.ImFloat(20.0)
local stimgui = imgui.ImBool(false)
local okno = imgui.ImBool(false)
local distance = imgui.ImFloat(200.0)
local radius = imgui.ImFloat(10.0)
local pause = imgui.ImBool(false)
imgui.Process = false
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage(huy .. 'Loaded!', -1)
sampRegisterChatCommand('saim', imguiMenu)
while true do
wait(0)
if okno.v == false then
imgui.Process = false
end
end
end
function imguiMenu()
okno.v = not okno.v
imgui.Process = okno.v
end
function imgui.OnDrawFrame()
local posX, posY = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(posX / 2, posY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(350, 200), imgui.Cond.FirstUseEver)
imgui.Begin('Silent aim', okno, imgui.WindowFlags.NoCollapse)
imgui.SliderFloat('Distance', distance, 0, 1000)
imgui.SliderFloat('Misses (in %)', missRatio, 0, 100)
imgui.Checkbox('State work', stimgui)
imgui.Checkbox('Check pause', pause)
imgui.End()
end
function sampev.onSendBulletSync(bulletData)
if stimgui.v then
local mukaMax = sampGetMaxPlayerId()
for muka = 0, mukaMax do
if sampIsPlayerConnected(muka) then
local _, handle = sampGetCharHandleBySampPlayerId(muka)
if not isCharDead(handle) then
local resultat = isCharOnScreen(handle)
if resultat then
local x1, y1, z1 = getCharCoordinates(PLAYER_PED)
local x2, y2, z2 = getCharCoordinates(handle)
if math.random(1, 100) > missRatio.v then
bulletData.targetType = 1
bulletData.targetId = muka
bulletData.target = { x = x2 + math.random(), y = y2 + math.random(), z = z2 + math.random() }
bulletData.center = { x = math.random(), y = math.random(), z = math.random() }
lua_thread.create(function ()
wait(1)
deagle = getCurrentCharWeapon(PLAYER_PED)
if deagle == 24 then
sampSendGiveDamage(muka, 46.200000762939, 24, 9)
else
sampAddChatMessage(huy .. 'Take deagle!', -1)
end
end)
end
end
end
end
end
end
end
 
Последнее редактирование модератором:

555Maximka556

Новичок
10
0
помогите с скриптом, мне надо чтоб у меня в имгуи біл слайдер, которій отвечает за радиус роботі вот код:


Lua:
require('lib.moonloader')
local imgui = require('lib.imgui')
local sampev = require('lib.samp.events')
local huy = '[Silent aim]: '
local missRatio = imgui.ImFloat(20.0)
local stimgui = imgui.ImBool(false)
local okno = imgui.ImBool(false)
local distance = imgui.ImFloat(200.0)
local radius = imgui.ImFloat(10.0)
local pause = imgui.ImBool(false)
imgui.Process = false
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage(huy .. 'Loaded!', -1)
sampRegisterChatCommand('saim', imguiMenu)
while true do
wait(0)
if okno.v == false then
imgui.Process = false
end
end
end
function imguiMenu()
okno.v = not okno.v
imgui.Process = okno.v
end
function imgui.OnDrawFrame()
local posX, posY = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(posX / 2, posY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(350, 200), imgui.Cond.FirstUseEver)
imgui.Begin('Silent aim', okno, imgui.WindowFlags.NoCollapse)
imgui.SliderFloat('Distance', distance, 0, 1000)
imgui.SliderFloat('Misses (in %)', missRatio, 0, 100)
imgui.Checkbox('State work', stimgui)
imgui.Checkbox('Check pause', pause)
imgui.End()
end
function sampev.onSendBulletSync(bulletData)
if stimgui.v then
local mukaMax = sampGetMaxPlayerId()
for muka = 0, mukaMax do
if sampIsPlayerConnected(muka) then
local _, handle = sampGetCharHandleBySampPlayerId(muka)
if not isCharDead(handle) then
local resultat = isCharOnScreen(handle)
if resultat then
local x1, y1, z1 = getCharCoordinates(PLAYER_PED)
local x2, y2, z2 = getCharCoordinates(handle)
if math.random(1, 100) > missRatio.v then
bulletData.targetType = 1
bulletData.targetId = muka
bulletData.target = { x = x2 + math.random(), y = y2 + math.random(), z = z2 + math.random() }
bulletData.center = { x = math.random(), y = math.random(), z = math.random() }
lua_thread.create(function ()
wait(1)
deagle = getCurrentCharWeapon(PLAYER_PED)
if deagle == 24 then
sampSendGiveDamage(muka, 46.200000762939, 24, 9)
else
sampAddChatMessage(huy .. 'Take deagle!', -1)
end
end)
end
end
end
end
end
end
end
Незнаю как в imgui, но в mimgui можно сделать так:
Lua:
-- где то в начале кода
local new = imgui.new
local slider = new.int(1) -- переменая хранящая в себе число слайдера

--уже в окне mimgui
imgui.SliderInt("test", slider, 1, 10) -- 1 аргумент название слайдера, 2 переменная слайдера, 3 минимальное значение, 4 максимальное
 
  • Злость
Реакции: qdIbp

qdIbp

Автор темы
Проверенный
1,386
1,141
52 строка
Вот так?
Lua:
require('lib.moonloader')
local imgui = require('imgui')
local sampev = require('lib.samp.events')

local huy = '[Silent aim]: '

local okno = imgui.ImBool(false)
local pause = imgui.ImBool(false)
local stimgui = imgui.ImBool(false)

local radius = imgui.ImFloat(10.0)
local missRatio = imgui.ImFloat(20.0)
local distance = imgui.ImFloat(200.0)

function main()
    repeat wait(0) until isSampAvailable()
    sampAddChatMessage(huy .. 'Loaded!', -1)
    sampRegisterChatCommand('saim', function()
        okno.v = not okno.v
        imgui.Process = okno.v
    end)
    while true do
        wait(0)
        if not(okno.v) then
            imgui.Process = false
        end
    end
end

function imgui.OnDrawFrame()
    local posX, posY = getScreenResolution()
    imgui.SetNextWindowPos(imgui.ImVec2(posX / 2, posY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(350, 200), imgui.Cond.FirstUseEver)
    imgui.Begin('Silent aim', okno, imgui.WindowFlags.NoCollapse)
        imgui.SliderFloat('Distance', distance, 0, 1000)
        imgui.SliderFloat('Misses (in %)', missRatio, 0, 100)
        imgui.Checkbox('State work', stimgui)
        imgui.Checkbox('Check pause', pause)
    imgui.End()
end
function sampev.onSendBulletSync(bulletData)
    if stimgui.v then
        local mukaMax = sampGetMaxPlayerId()
        for muka = 0, mukaMax do
            if sampIsPlayerConnected(muka) then
                local _, handle = sampGetCharHandleBySampPlayerId(muka)
                if not isCharDead(handle) then
                    local resultat = isCharOnScreen(handle)
                    if resultat then
                        local x1, y1, z1 = getCharCoordinates(playerPed)
                        local x2, y2, z2 = getCharCoordinates(handle)
                        local dist = getDistanceBetweenCoords3d(x1, y1, z1,x2, y2, z2) <= distance.v
                        if math.random(1, 100) > missRatio.v and dist then
                            bulletData.targetType = 1
                            bulletData.targetId = muka
                            bulletData.target = { x = x2 + math.random(), y = y2 + math.random(), z = z2 + math.random() }
                            bulletData.center = { x = math.random(), y = math.random(), z = math.random() }
                            lua_thread.create(function ()
                                wait(1)
                                if getCurrentCharWeapon(playerPed) == 24 then
                                    sampSendGiveDamage(muka, 46.200000762939, 24, 9)
                                else
                                    sampAddChatMessage(huy .. 'Take deagle!', -1)
                                end
                            end)
                        end
                    end
                end
            end
        end
    end
end
 
  • Эм
Реакции: ChromiusJ