Sniper-Triggerbot

Xentron

Известный
Автор темы
15
0
Версия MoonLoader
.026-beta
Как сделать sn ipertriggerbot. Я не могу определить положение прицела снайпера и адрес, когда стрелять

How to make Snipetriggerbot for LUA
 

Fott

Простреленный
3,461
2,378
Xz
Lua:
local ffi = require "ffi"
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local memory = require 'memory'

function main()
while not isSampAvailable() do wait(0) end wait(1)
    while true do
        wait(0)
        for i = 0, sampGetMaxPlayerId() do
        local result, ped = sampGetCharHandleBySampPlayerId(i)
            if result and isCharOnScreen(ped) then
                posX, posY, w, h, headx, heady, legrx, legry, leglx, legly = GetSkinParams(ped)
                lua_thread.create(shoot)
            end
        end
    end
end

function shoot()
    posX = posX - 320
    posY = posY - 224
    posX =  math.abs(posX)
    posY =  math.abs(posY)

    headx = headx - 320
    heady = heady - 224
    headx =  math.abs(headx)
    heady =  math.abs(heady)

    legrx = legrx - 320
    legry = legry - 224
    legrx =  math.abs(legrx)
    legry =  math.abs(legry)

    leglx = leglx - 320
    legly = legly - 224
    leglx =  math.abs(leglx)
    legly =  math.abs(legly)

    d2232 = d2232 / 2
    d14 = d14 / 2
    if posX <= d2232 and posY <= d14 and getActiveCamMode() == 7 and active then -- тело
        setGameKeyState(17, 255)
    elseif headx <= d2232 and heady <= d14 and getActiveCamMode() == 7 and active then -- бошка
        setGameKeyState(17, 255)
    elseif legrx <= d2232 and legry <= d14 and getActiveCamMode() == 7 and active then -- правая нога
        setGameKeyState(17, 255)
    elseif leglx <= d2232 and legly <= d14 and getActiveCamMode() == 7 and active then -- левая нога
        setGameKeyState(17, 255)  
    end
end

function getActiveCamMode()
    local activeCamId = memory.getint8(0x00B6F028 + 0x59)
    return getCamMode(activeCamId)
end

function getCamMode(id)
    local cams = 0x00B6F028 + 0x174
    local cam = cams + id * 0x238
    return memory.getint16(cam + 0x0C)
end

function GetSkinParams(pedik)
    X22, Y22, Z22 = getBodyPartCoordinates(22, pedik)
    local xx22, yy22 = convert3DCoordsToScreen(X22, Y22, Z22)
    xxx22, yyy22 = convertWindowScreenCoordsToGameScreenCoords(xx22, yy22)

    X32, Y32, Z32 = getBodyPartCoordinates(32, pedik)
    local xx32, yy32 = convert3DCoordsToScreen(X32, Y32, Z32)
    xxx32, yyy32 = convertWindowScreenCoordsToGameScreenCoords(xx32, yy32)

    d2232 = getDistanceBetweenCoords2d(xxx22, yyy22, xxx32, yyy32) -- ШИРИНА СКИНА

    X1, Y1, Z1 = getBodyPartCoordinates(1, pedik)
    local xx1, yy1 = convert3DCoordsToScreen(X1, Y1, Z1)
    xxx1, yyy1 = convertWindowScreenCoordsToGameScreenCoords(xx1, yy1)

    X4, Y4, Z4 = getBodyPartCoordinates(4, pedik)
    local xx4, yy4 = convert3DCoordsToScreen(X4, Y4, Z4)
    xxx4, yyy4 = convertWindowScreenCoordsToGameScreenCoords(xx4, yy4)

    d14 = getDistanceBetweenCoords2d(xxx22, yyy22, xxx32, yyy32) -- ВЫСОТА СКИНА

    X3, Y3, Z3 = getBodyPartCoordinates(3, pedik)
    local xx3, yy3 = convert3DCoordsToScreen(X3, Y3, Z3)
    xxx3, yyy3 = convertWindowScreenCoordsToGameScreenCoords(xx3, yy3)

    X6, Y6, Z6 = getBodyPartCoordinates(6, pedik)
    local xx6, yy6 = convert3DCoordsToScreen(X6, Y6, Z6)
    xxx6, yyy6 = convertWindowScreenCoordsToGameScreenCoords(xx6, yy6)

    X52, Y52, Z52 = getBodyPartCoordinates(52, pedik)
    local xx52, yy52 = convert3DCoordsToScreen(X52, Y52, Z52)
    xxx52, yyy52 = convertWindowScreenCoordsToGameScreenCoords(xx52, yy52)

    X42, Y42, Z42 = getBodyPartCoordinates(42, pedik)
    local xx42, yy42 = convert3DCoordsToScreen(X42, Y42, Z42)
    xxx42, yyy42 = convertWindowScreenCoordsToGameScreenCoords(xx42, yy42)

    return xxx3, yyy3, d2232, d14, xxx6, yyy6, xxx52, yyy52, xxx42, yyy42
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
 

Xentron

Известный
Автор темы
15
0
Xz
Lua:
local ffi = require "ffi"
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local memory = require 'memory'

function main()
while not isSampAvailable() do wait(0) end wait(1)
    while true do
        wait(0)
        for i = 0, sampGetMaxPlayerId() do
        local result, ped = sampGetCharHandleBySampPlayerId(i)
            if result and isCharOnScreen(ped) then
                posX, posY, w, h, headx, heady, legrx, legry, leglx, legly = GetSkinParams(ped)
                lua_thread.create(shoot)
            end
        end
    end
end

function shoot()
    posX = posX - 320
    posY = posY - 224
    posX =  math.abs(posX)
    posY =  math.abs(posY)

    headx = headx - 320
    heady = heady - 224
    headx =  math.abs(headx)
    heady =  math.abs(heady)

    legrx = legrx - 320
    legry = legry - 224
    legrx =  math.abs(legrx)
    legry =  math.abs(legry)

    leglx = leglx - 320
    legly = legly - 224
    leglx =  math.abs(leglx)
    legly =  math.abs(legly)

    d2232 = d2232 / 2
    d14 = d14 / 2
    if posX <= d2232 and posY <= d14 and getActiveCamMode() == 7 and active then -- тело
        setGameKeyState(17, 255)
    elseif headx <= d2232 and heady <= d14 and getActiveCamMode() == 7 and active then -- бошка
        setGameKeyState(17, 255)
    elseif legrx <= d2232 and legry <= d14 and getActiveCamMode() == 7 and active then -- правая нога
        setGameKeyState(17, 255)
    elseif leglx <= d2232 and legly <= d14 and getActiveCamMode() == 7 and active then -- левая нога
        setGameKeyState(17, 255) 
    end
end

function getActiveCamMode()
    local activeCamId = memory.getint8(0x00B6F028 + 0x59)
    return getCamMode(activeCamId)
end

function getCamMode(id)
    local cams = 0x00B6F028 + 0x174
    local cam = cams + id * 0x238
    return memory.getint16(cam + 0x0C)
end

function GetSkinParams(pedik)
    X22, Y22, Z22 = getBodyPartCoordinates(22, pedik)
    local xx22, yy22 = convert3DCoordsToScreen(X22, Y22, Z22)
    xxx22, yyy22 = convertWindowScreenCoordsToGameScreenCoords(xx22, yy22)

    X32, Y32, Z32 = getBodyPartCoordinates(32, pedik)
    local xx32, yy32 = convert3DCoordsToScreen(X32, Y32, Z32)
    xxx32, yyy32 = convertWindowScreenCoordsToGameScreenCoords(xx32, yy32)

    d2232 = getDistanceBetweenCoords2d(xxx22, yyy22, xxx32, yyy32) -- ШИРИНА СКИНА

    X1, Y1, Z1 = getBodyPartCoordinates(1, pedik)
    local xx1, yy1 = convert3DCoordsToScreen(X1, Y1, Z1)
    xxx1, yyy1 = convertWindowScreenCoordsToGameScreenCoords(xx1, yy1)

    X4, Y4, Z4 = getBodyPartCoordinates(4, pedik)
    local xx4, yy4 = convert3DCoordsToScreen(X4, Y4, Z4)
    xxx4, yyy4 = convertWindowScreenCoordsToGameScreenCoords(xx4, yy4)

    d14 = getDistanceBetweenCoords2d(xxx22, yyy22, xxx32, yyy32) -- ВЫСОТА СКИНА

    X3, Y3, Z3 = getBodyPartCoordinates(3, pedik)
    local xx3, yy3 = convert3DCoordsToScreen(X3, Y3, Z3)
    xxx3, yyy3 = convertWindowScreenCoordsToGameScreenCoords(xx3, yy3)

    X6, Y6, Z6 = getBodyPartCoordinates(6, pedik)
    local xx6, yy6 = convert3DCoordsToScreen(X6, Y6, Z6)
    xxx6, yyy6 = convertWindowScreenCoordsToGameScreenCoords(xx6, yy6)

    X52, Y52, Z52 = getBodyPartCoordinates(52, pedik)
    local xx52, yy52 = convert3DCoordsToScreen(X52, Y52, Z52)
    xxx52, yyy52 = convertWindowScreenCoordsToGameScreenCoords(xx52, yy52)

    X42, Y42, Z42 = getBodyPartCoordinates(42, pedik)
    local xx42, yy42 = convert3DCoordsToScreen(X42, Y42, Z42)
    xxx42, yyy42 = convertWindowScreenCoordsToGameScreenCoords(xx42, yy42)

    return xxx3, yyy3, d2232, d14, xxx6, yyy6, xxx52, yyy52, xxx42, yyy42
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

Не стреляет
 

Похожие темы

  1. Ответы
    7
    Просмотры
    8K
  2. Ответы
    6
    Просмотры
    2K