не работает 2 функция

By.Egorka

Участник
Автор темы
75
18
Версия MoonLoader
.026-beta
Всем привет когда
проблема такая когда я добавил автошот
перестал работать вх
Code:
require("lib.moonloader")
local imgui = require "imgui"
local ffi = require "ffi"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8

local avtosh = false
local main_window_state = imgui.ImBool(false)
local vxkosti = imgui.ImBool(false)
local avtosh = imgui.ImBool(false)
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280) -- хрень для вх

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
 
 
    sampRegisterChatCommand('gg', function()
        main_window_state.v = not main_window_state.v
    end)
 
    imgui.Process = false
    main_window_state.v = false
 
    while true do wait(0)
         imgui.Process = main_window_state.v
        if avtosh.v then
            local int = readMemory(0xB6F3B8, 4, 0)
            int=int + 0x79C
            local intS = readMemory(int, 4, 0)
                if intS > 0
                then
                local lol = 0xB73458
                lol=lol + 34
                writeMemory(lol, 4, 255, 0)
                wait(100)
                local int = readMemory(0xB6F3B8, 4, 0)
                int=int + 0x79C
                writeMemory(int, 4, 0, 0)
            end
        end
    end


    while true do wait(0)
         imgui.Process = main_window_state.v
        if vxkosti.v then
            for i = 0, sampGetMaxPlayerId() do
                if sampIsPlayerConnected(i) then
                    local result, cped = sampGetCharHandleBySampPlayerId(i)
                    local color = sampGetPlayerColor(i)
                    local aa, rr, gg, bb = explode_argb(color)
                    local color = join_argb(255, rr, gg, bb)
                    if result then
                        if doesCharExist(cped) and isCharOnScreen(cped) then
                        local t = {3, 4, 5, 51, 52, 41, 42, 31, 32, 33, 21, 22, 23, 2}
                            for v = 1, #t do
                                pos1X, pos1Y, pos1Z = getBodyPartCoordinates(t[v], cped)
                                pos2X, pos2Y, pos2Z = getBodyPartCoordinates(t[v] + 1, cped)
                                pos1, pos2 = convert3DCoordsToScreen(pos1X, pos1Y, pos1Z)
                                pos3, pos4 = convert3DCoordsToScreen(pos2X, pos2Y, pos2Z)
                                renderDrawLine(pos1, pos2, pos3, pos4, 2, color)
                            end
                            for v = 4, 5 do
                                pos2X, pos2Y, pos2Z = getBodyPartCoordinates(v * 10 + 1, cped)
                                pos3, pos4 = convert3DCoordsToScreen(pos2X, pos2Y, pos2Z)
                                renderDrawLine(pos1, pos2, pos3, pos4, 2, color)
                            end
                            local t = {53, 43, 24, 34, 6}
                            for v = 1, #t do
                                 posX, posY, posZ = getBodyPartCoordinates(t[v], cped)
                                pos1, pos2 = convert3DCoordsToScreen(posX, posY, posZ)
                            end
                        end
                    end
                end
            end
        end
    end
end 

function imgui.OnDrawFrame()
    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(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"vx", main_window_state)
        imgui.Checkbox(u8"Vx", vxkosti)
        imgui.Checkbox(u8"AvtoShot", avtosh)
        imgui.End()
      end
end

-- где то в конце

function explode_argb(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

function join_argb(a, r, g, b) -- by FYP
    local argb = b  -- b
    argb = bit.bor(argb, bit.lshift(g, 8))  -- g
    argb = bit.bor(argb, bit.lshift(r, 16)) -- r
    argb = bit.bor(argb, bit.lshift(a, 24)) -- a
    return argb
end

function getBodyPartCoordinates(id, handle)
    local pedptr = getCharPointer(handle)
    local vec = ffi.new("float[3]")
    getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
    return vec[0], vec[1], vec[2]
end
 
  • Грустно
Реакции: qdIbp
Решение
Попробуй так
Lua:
require("lib.moonloader")
local imgui = require "imgui"
local ffi = require "ffi"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8

local avtosh = false
local main_window_state = imgui.ImBool(false)
local vxkosti = imgui.ImBool(false)
local avtosh = imgui.ImBool(false)
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280) -- хрень для вх

function main()
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('gg', function()
        main_window_state.v = not main_window_state.v
    end)
 
    imgui.Process = false
    main_window_state.v = false
 
    while true do wait(0)
        imgui.Process = main_window_state.v
        if...

qdIbp

Автор темы
Проверенный
1,438
1,180
Попробуй так
Lua:
require("lib.moonloader")
local imgui = require "imgui"
local ffi = require "ffi"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8

local avtosh = false
local main_window_state = imgui.ImBool(false)
local vxkosti = imgui.ImBool(false)
local avtosh = imgui.ImBool(false)
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280) -- хрень для вх

function main()
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('gg', function()
        main_window_state.v = not main_window_state.v
    end)
 
    imgui.Process = false
    main_window_state.v = false
 
    while true do wait(0)
        imgui.Process = main_window_state.v
        if avtosh.v then
            local int = readMemory(0xB6F3B8, 4, 0)
            int = int + 0x79C
            local intS = readMemory(int, 4, 0)
            if intS > 0 then
                local lol = 0xB73458
                lol = lol + 34
                writeMemory(lol, 4, 255, 0)
                wait(100)
                local int = readMemory(0xB6F3B8, 4, 0)
                int=int + 0x79C
                writeMemory(int, 4, 0, 0)
            end
        end

        if vxkosti.v then
            for i = 0, sampGetMaxPlayerId() do
                if sampIsPlayerConnected(i) then
                    local result, cped = sampGetCharHandleBySampPlayerId(i)
                    local color = sampGetPlayerColor(i)
                    local aa, rr, gg, bb = explode_argb(color)
                    local color = join_argb(255, rr, gg, bb)
                    if result then
                        if doesCharExist(cped) and isCharOnScreen(cped) then
                            local t = {3, 4, 5, 51, 52, 41, 42, 31, 32, 33, 21, 22, 23, 2}
                            for v = 1, #t do
                                pos1X, pos1Y, pos1Z = getBodyPartCoordinates(t[v], cped)
                                pos2X, pos2Y, pos2Z = getBodyPartCoordinates(t[v] + 1, cped)
                                pos1, pos2 = convert3DCoordsToScreen(pos1X, pos1Y, pos1Z)
                                pos3, pos4 = convert3DCoordsToScreen(pos2X, pos2Y, pos2Z)
                                renderDrawLine(pos1, pos2, pos3, pos4, 2, color)
                            end
                            for v = 4, 5 do
                                pos2X, pos2Y, pos2Z = getBodyPartCoordinates(v * 10 + 1, cped)
                                pos3, pos4 = convert3DCoordsToScreen(pos2X, pos2Y, pos2Z)
                                renderDrawLine(pos1, pos2, pos3, pos4, 2, color)
                            end
                            local t = {53, 43, 24, 34, 6}
                            for v = 1, #t do
                                 posX, posY, posZ = getBodyPartCoordinates(t[v], cped)
                                pos1, pos2 = convert3DCoordsToScreen(posX, posY, posZ)
                            end
                        end
                    end
                end
            end
        end
       
    end
end

function imgui.OnDrawFrame()
    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(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"vx", main_window_state)
            imgui.Checkbox(u8"Vx", vxkosti)
            imgui.Checkbox(u8"AvtoShot", avtosh)
        imgui.End()
    end
end

-- где то в конце

function explode_argb(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

function join_argb(a, r, g, b)
    local argb = b  -- b
    argb = bit.bor(argb, bit.lshift(g, 8))  -- g
    argb = bit.bor(argb, bit.lshift(r, 16)) -- r
    argb = bit.bor(argb, bit.lshift(a, 24)) -- a
    return argb
end

function getBodyPartCoordinates(id, handle)
    local pedptr = getCharPointer(handle)
    local vec = ffi.new("float[3]")
    getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
    return vec[0], vec[1], vec[2]
end

хотя все советуют на mimgui переходить, пока не поздно, одумайся!
 
  • Нравится
Реакции: MLycoris и By.Egorka