Помогите с аимом на объекты, прицел тепается ниже

Expl0ncee

Участник
Автор темы
126
10
Скачать аим на объекты, указал ид бутылок (что-бы качать скиллы), по итогу стреляю в 19 из 20 бутылок, а на 20 бутылку прицел тепает ниже самой бутылки (см. ниже) (код аима также приложил)

script_author('N08I40K')

local imgui = require 'imgui'
local encoding = require 'encoding'
local inicfg = require 'inicfg'

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

local scrWindows = imgui.ImBool(false)

local scrCheckOnScreen = imgui.ImBool(false)
local scrCheckWalls = imgui.ImBool(false)

local scrRage = imgui.ImBool(false)
local scrRageCooldown = imgui.ImInt(500)
local scrMinusAmmo = imgui.ImBool(true)

local scrObjectAim = imgui.ImBool(false)
local scrObjectModel = imgui.ImInt(0)

local scr3dTextAim = imgui.ImBool(false)
local scr3dTextText = imgui.ImBuffer(u8("Каво нахуй?"), 64)

local scrCarAim = imgui.ImBool(false)
local scrCarModel = imgui.ImInt(0)

local default_config = {settings =
{
scrRage = false,
scrRageCooldown = 500,
scrMinusAmmo = true,

scrCheckOnScreen = true,
scrCheckWalls = true,

scrObjectAim = false,
scrObjectModel = 0,

scr3dTextAim = false,
scr3dTextText = "0-0",

scrCarAim = false,
scrCarModel = 0
}}
local config = inicfg.load({settings =
{
scrRage = scrRage.v,
scrRageCooldown = scrRageCooldown.v,
scrMinusAmmo = scrMinusAmmo.v,

scrCheckOnScreen = scrCheckOnScreen.v,
scrCheckWalls = scrCheckWalls.v,

scrObjectAim = scrObjectAim.v,
scrObjectModel = scrObjectModel.v,

scr3dTextAim = scr3dTextAim.v,
scr3dTextText = scr3dTextText.v,

scrCarAim = scrCarAim.v,
scrCarModel = scrCarModel.v

}})

function LoadSettings()
local file = inicfg.load(config, script.this.filename..'.ini')
if file == nil then
inicfg.save(default_config, script.this.filename..'.ini')
file = inicfg.load(config, script.this.filename..'.ini')
end

scrRage.v = file.settings.scrRage
scrRageCooldown.v = file.settings.scrRageCooldown
scrMinusAmmo.v = file.settings.scrMinusAmmo

scrCheckOnScreen.v = file.settings.scrCheckOnScreen
scrCheckWalls.v = file.settings.scrCheckWalls

scrObjectAim.v=file.settings.scrObjectAim
scrObjectModel.v=file.settings.scrObjectModel

scr3dTextAim.v=file.settings.scr3dTextAim
scr3dTextText.v=file.settings.scr3dTextText

scrCarAim.v=file.settings.scrCarAim
scrCarModel.v=file.settings.scrCarModel
end

function SaveSettings()
inicfg.save(config, script.this.filename..'.ini')
end

function imgui.OnDrawFrame()
if scrWindows.v then

imgui.Begin(u8'[MoreAim]', scrWindows, imgui.WindowFlags.AlwaysAutoResize)

if imgui.Checkbox(u8'Рейдж режим', scrRage) then
config.settings.scrRage = scrRage.v
SaveSettings()
end

if imgui.InputInt(u8'Кд между выстрелами', scrRageCooldown) then
config.settings.scrRageCooldown = scrRageCooldown.v
SaveSettings()
end

if imgui.Checkbox(u8'Тратить патроны при выстреле', scrMinusAmmo) then
config.settings.scrMinusAmmo = scrMinusAmmo.v
SaveSettings()
end

if imgui.Checkbox(u8'Игнорировать то что не на экране', scrCheckOnScreen) then
config.settings.scrCheckOnScreen = scrCheckOnScreen.v
SaveSettings()
end

if imgui.Checkbox(u8'Игнорировать то что находится за стеной', scrCheckWalls) then
config.settings.scrCheckWalls = scrCheckWalls.v
SaveSettings()
end

if imgui.Checkbox(u8'На объекты', scrObjectAim) then
config.settings.scrObjectAim = scrObjectAim.v
SaveSettings()
end
imgui.SameLine()
if imgui.InputInt(u8'Модель объекта', scrObjectModel) then
config.settings.scrObjectModel = scrObjectModel.v
SaveSettings()
end

if imgui.Checkbox(u8'На 3д текст', scr3dTextAim) then
config.settings.scr3dTextAim = scr3dTextAim.v
SaveSettings()
end
imgui.SameLine()
if imgui.InputText(u8'Часть текста', scr3dTextText) then
config.settings.scr3dTextText = scr3dTextText.v
SaveSettings()
end

if imgui.Checkbox(u8'На кары', scrCarAim) then
config.settings.scrCarAim = scrCarAim.v
SaveSettings()
end
imgui.SameLine()
if imgui.InputInt(u8'Модель кара', scrCarModel) then
config.settings.scrCarModel = scrCarModel.v
SaveSettings()
end
imgui.End()
end
end
function BulletSync(byteType, sTargetID, fOriginX, fOriginY, fOriginZ, fTargetX, fTargetY, fTargetZ, fCenterX, fCenterY, fCenterZ, byteWeaponID)
local struct = allocateMemory(40)
setStructElement(struct, 0, 1, byteType)
setStructElement(struct, 1, 2, sTargetID)
setStructElement(struct, 3, 4, representFloatAsInt(fOriginX))
setStructElement(struct, 7, 4, representFloatAsInt(fOriginY))
setStructElement(struct, 11, 4, representFloatAsInt(fOriginZ))
setStructElement(struct, 15, 4, representFloatAsInt(fTargetX))
setStructElement(struct, 19, 4, representFloatAsInt(fTargetY))
setStructElement(struct, 23, 4, representFloatAsInt(fTargetZ))
setStructElement(struct, 27, 4, representFloatAsInt(fCenterX))
setStructElement(struct, 31, 4, representFloatAsInt(fCenterY))
setStructElement(struct, 35, 4, representFloatAsInt(fCenterZ))
setStructElement(struct, 39, 1, byteWeaponID)
sampSendBulletData(struct)
freeMemory(struct)
end
local syncSot_1 = false
local syncSot_2 = false
function main()
if not isSampLoaded() or not isCleoLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(200) end

LoadSettings()
sampRegisterChatCommand('maim', function() scrWindows.v = not scrWindows.v end)
lua_thread.create(function ()
while true do
wait(0)
local camMode = readMemory(0xB6F1A8, 1, false)
if camMode == 53 or camMode == 55 or camMode == 7 or camMode == 8 then
local targeted = false
if scrObjectAim.v then
for _, v in pairs(getAllObjects()) do
if checkObject(v) then
local _, x, y, z = getObjectCoordinates(v)
targetAtCoords(x, y, z)
if not syncSot_1 and scrRage.v then
local weapon = getCurrentCharWeapon(playerPed)
if weapon > 0 and getAmmoInCharWeapon(PLAYER_PED, weapon) > 1 then
local px, py, pz = getCharCoordinates(playerPed)
local iid = sampGetObjectSampIdByHandle(v)
syncSot_1 = true
lua_thread.create(function ()
BulletSync(3, iid, px, py, pz, x, y, z, 0.0, 0.0, 0.0, weapon)
if scrMinusAmmo.v then
setCharAmmo(PLAYER_PED, weapon, getAmmoInCharWeapon(PLAYER_PED, weapon)-1)
end
wait(scrRageCooldown.v)
syncSot_1 = false
end)
end
end
targeted = true
break
end
end
end
if not targeted and scr3dTextAim.v then
local text_to_search = tostring(u8:decode(scr3dTextText.v))
for i = 0, 2048 do
if check3dText(i, text_to_search) then
local text, color, x, y, z, distance, ignoreWalls, playerId, vehicleId = sampGet3dTextInfoById(i)
targetAtCoords(x, y, z)
targeted = true
break
end
end
end
if not targeted and scrCarAim.v then
for _, handle in ipairs(getAllVehicles()) do
if checkCar(handle) then
local x, y, z = getCarCoordinates(handle)
targetAtCoords(x, y, z)
if not syncSot_2 and scrRage.v then
local weapon = getCurrentCharWeapon(playerPed)
if weapon > 0 and getAmmoInCharWeapon(PLAYER_PED, weapon) > 1 then
local px, py, pz = getCharCoordinates(playerPed)
result, iid = sampGetVehicleIdByCarHandle(handle)
syncSot_2 = true
lua_thread.create(function ()
BulletSync(2, iid, px, py, pz, x, y, z, 0.0, 0.0, 0.0, weapon)
if scrMinusAmmo.v then
setCharAmmo(PLAYER_PED, weapon, getAmmoInCharWeapon(PLAYER_PED, weapon)-1)
end
wait(scrRageCooldown.v)
syncSot_2 = false
end)
end
end
break
end
end
end
end
end
end)
while true do
wait(0)
imgui.Process = scrWindows.v
end
end

function check3dText(handle, text_to_search)

if not sampIs3dTextDefined(handle) then
return false
end
local text, color, x, y, z, distance, ignoreWalls, playerId, vehicleId = sampGet3dTextInfoById(handle)

if scrCheckOnScreen.v and not isPointOnScreen(x, y, z, 1.0) then
return false
end

if not string.find(text, text_to_search) then
return false
end

if scrCheckWalls.v then
local pedX, pedY, pedZ = getActiveCameraCoordinates()
local result, colPoint = processLineOfSight(pedX, pedY, pedZ, x, y, z, true, false, false, false, false, false, false, false)
if result then
return false
end
end

return true
end

function checkObject(handle)
if not doesObjectExist(handle) then
return false
end
local _, x, y, z = getObjectCoordinates(handle)
local model = getObjectModel(handle)
if scrCheckOnScreen.v and not isObjectOnScreen(handle) then
return false
end

if model ~= scrObjectModel.v then
return false
end
if scrCheckWalls.v then
local pedX, pedY, pedZ = getActiveCameraCoordinates()
local result, colPoint = processLineOfSight(pedX, pedY, pedZ, x, y, z, true, false, false, false, false, false, false, false)
if result then
return false
end
end

return true
end

function checkCar(handle)
if not doesVehicleExist(handle) then
return false
end

if scrCheckOnScreen.v and not isCarOnScreen(handle) then
return false
end

if scrCarModel.v ~= -1 and getCarModel(handle) ~= scrCarModel.v then
return false
end

if scrCheckWalls.v then
local pedX, pedY, pedZ = getActiveCameraCoordinates()
local x, y, z = getCarCoordinates(handle)
local result, colPoint = processLineOfSight(pedX, pedY, pedZ, x, y, z, true, false, false, false, false, false, false, false)
if result then
return false
end
end

return true
end

function targetAtCoords(x, y, z)
local cx, cy, cz = getActiveCameraCoordinates()

local vect = {
fX = cx - x,
fY = cy - y,
fZ = cz - z
}

local screenAspectRatio = representIntAsFloat(readMemory(0xC3EFA4, 4, false))
local crosshairOffset = {
representIntAsFloat(readMemory(0xB6EC10, 4, false)),
representIntAsFloat(readMemory(0xB6EC14, 4, false))
}

-- weird shit
local mult = math.tan(getCameraFov() * 0.5 * 0.017453292)
fz = 3.14159265 - math.atan2(1.0, mult * ((0.5 - crosshairOffset[1]) * (2 / screenAspectRatio)))
fx = 3.14159265 - math.atan2(1.0, mult * 2 * (crosshairOffset[2] - 0.5))

local camMode = readMemory(0xB6F1A8, 1, false)

if not (camMode == 53 or camMode == 55) then -- sniper rifle etc.
fx = 3.14159265 / 2
fz = 3.14159265 / 2
end

local ax = math.atan2(vect.fY, -vect.fX) - 3.14159265 / 2
local az = math.atan2(math.sqrt(vect.fX * vect.fX + vect.fY * vect.fY), vect.fZ)

setCameraPositionUnfixed(az - fz, fx - ax)
end
1650058131696.png
 

Вложения

  • ObectAim.lua
    10.6 KB · Просмотры: 11