Как сделать вх???

By.Egorka

Участник
Автор темы
70
18
Версия MoonLoader
.026-beta

Всем приветик!

Я щас пишу imgui вх на чеовека как жто сделать??

говнокод:
local imgui = require 'imgui'
local key = require 'vkeys'

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

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
     if main_window_state.v then
         imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
         imgui.Begin("Вх на объекты, человека", main_window_state)
         imgui.Text("ВX")

        
         if imgui.Button("Вх на человека")then
          

   end
    imgui.End()
  end
end


function main()
  while true do
    wait(0)
    if wasKeyPressed(key.VK_X) then
        main_window_state.v = not main_window_state.v
    end
    imgui.Process = main_window_state.v
  end
end
 

why ega

РП игрок
Модератор
2,547
2,239

Всем приветик!

Я щас пишу imgui вх на чеовека как жто сделать??

вызывай в бесконечном цилкле
Lua:
local memory = require("memory")


function wallHack()
    local sampSettings = sampGetServerSettingsPtr()
    memory.setfloat(sampSettings + 0x27, 300.00, true) -- дистанция ников
    memory.setint8(sampSettings + 0x2F, 0) -- ники сквозь стены
end
 
  • Нравится
Реакции: arpix

arpix

Активный
120
33
Вот фулл код, проверил, всё работает (вх на кости)
Lua:
-- вх на кости
require("lib.moonloader")
local imgui = require "imgui"
local ffi = require "ffi"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8

local main_window_state = imgui.ImBool(false)
local vxkosti = 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('test', function() -- команда активации /test
        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 vxkosti.v then -- если активен чекбокс vxkosti то
            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"ВХ", main_window_state)
        imgui.Checkbox(u8"ВХ на кости", vxkosti)
        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

sa-mp-378.png
 
  • Нравится
Реакции: By.Egorka