skszikri
Member
- Joined
- Apr 20, 2023
- Messages
- 18
- Reaction score
- 1
local imgui = require('imgui')
local vkeys = require('vkeys')
local ffi = require('ffi')
local getVehiclePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local mainWindowState = imgui.ImBool(false)
local smooth = imgui.ImFloat(0.0)
local radius = imgui.ImFloat(0.6)
local enable = imgui.ImBool(false)
local clistFilter = imgui.ImBool(false)
local visibleCheck = imgui.ImBool(false)
local checkStuned = imgui.ImBool(false)
local checkPause = imgui.ImBool(false)
function main()
repeat wait(0) until isSampAvailable()
lua_thread.create(smooth_aimbot)
while true do
wait(0)
if wasKeyPressed(vkeys.VK_INSERT) then
mainWindowState.v = not mainWindowState.v
end
imgui.Process = mainWindowState.v
end
end
function imgui.OnDrawFrame()
local posX, posY = getScreenResolution()
if mainWindowState.v then
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('Smooth aimbot', mainWindowState)
imgui.SliderFloat('Radius', radius, 0.0, 100.0, '%.1f')
imgui.SliderFloat('Smooth', smooth, 0.0, 50.0, '%.1f')
imgui.Checkbox('Enable', enable)
imgui.Checkbox('VisibleCheck', visibleCheck)
imgui.Checkbox('CheckStuned', checkStuned)
imgui.Checkbox('ClistFilter', clistFilter)
imgui.Checkbox('CheckPause', checkPause)
imgui.End()
end
end
function fix(angle)
if angle > math.pi then
angle = angle - (math.pi * 2)
elseif angle < -math.pi then
angle = angle + (math.pi * 2)
end
return angle
end
function GetNearestVehicle(fov)
local maxDistance = 35
local nearestVehicle = -1
for i = 0, sampGetMaxPlayerId(true) do
if sampIsPlayerConnected(i) then
local find, handle = sampGetVehicleHandleBySampPlayerId(i)
if find then
if isVehicleOnScreen(handle) then
if not isVehicleDead(handle) then
local _, currentID = sampGetPlayerIdByCharHandle(PLAYER_PED)
local vehiclePos = {getVehiclePosition(handle)}
local myPos = {getActiveCameraCoordinates()}
local vector = {myPos[1] - vehiclePos[1], myPos[2] - vehiclePos[2], myPos[3] - vehiclePos[3]}
if isWidescreenOnInOptions() then coefficentZ = 0.0778 else coefficentZ = 0.103 end
local angle = {(math.atan2(vector[2], vector[1]) + 0.04253), (math.atan2((math.sqrt((math.pow(vector[1], 2) + math.pow(vector[2], 2)))), vector[3]) - math.pi / 2 - coefficentZ)}
local view = {fix(representIntAsFloat(readMemory(0xB6F258, 4, false))), fix(representIntAsFloat(readMemory(0xB6F248, 4, false)))}
local distance = math.sqrt((math.pow(angle[1] - view[1], 2) + math.pow(angle[2] - view[2], 2))) * 57.2957795131
if distance > fov then check = true else check = false end
if not check then
local myPos = {getCharCoordinates(PLAYER_PED)}
local distance = math.sqrt((math.pow((vehiclePos[1] - myPos[1]), 2) + math.pow((vehiclePos[2] - myPos[2]), 2) + math.pow((vehiclePos[3] - myPos[3]), 2)))
if (distance < maxDistance) then
nearestVehicle = handle
maxDistance = distance
end
end
end
end
end
end
end
return nearestVehicle
end
function GetBodyPartCoordinates(id, handle)
-- Function to get vehicle coordinates directly
if doesVehicleExist(handle) then
local vehptr = getVehiclePointer(handle)
local vec = ffi.new("float[3]")
getVehiclePosition(ffi.cast("void*", vehptr), vec, id, true)
return vec[0], vec[1], vec[2]
end
end
function smooth_aimbot()
if enable.v and isKeyDown(vkeys.VK_RBUTTON) then
local handle = GetNearestVehicle(radius.v)
if handle ~= -1 then
local _, myID = sampGetPlayerIdByCharHandle(PLAYER_PED)
local result, playerID = sampGetPlayerIdByCharHandle(handle)
if result then
if (checkStuned.v and not CheckStuned()) then return false end
if (clistFilter.v and sampGetPlayerColor(myID) == sampGetPlayerColor(playerID)) then return false end
if (checkPause.v and sampIsPlayerPaused(playerID)) then return false end
local myPos = {getActiveCameraCoordinates()}
local vehiclePos = {GetBodyPartCoordinates(0, handle)} -- Using ID 0 or modify as needed
if not visibleCheck.v or (visibleCheck.v and isLineOfSightClear(myPos[1], myPos[2], myPos[3], vehiclePos[1], vehiclePos[2], vehiclePos[3], true, true, false, true, true)) then
local vector = {myPos[1] - vehiclePos[1], myPos[2] - vehiclePos[2], myPos[3] - vehiclePos[3]}
if isWidescreenOnInOptions() then coefficentZ = 0.0778 else coefficentZ = 0.103 end
local angle = {(math.atan2(vector[2], vector[1]) + 0.04253), (math.atan2((math.sqrt((math.pow(vector[1], 2) + math.pow(vector[2], 2)))), vector[3]) - math.pi / 2 - coefficentZ)}
local view = {fix(representIntAsFloat(readMemory(0xB6F258, 4, false))), fix(representIntAsFloat(readMemory(0xB6F248, 4, false)))}
local difference = {angle[1] - view[1], angle[2] - view[2]}
local smooth = {difference[1] / smooth.v, difference[2] / smooth.v}
setCameraPositionUnfixed((view[2] + smooth[2]), (view[1] + smooth[1]))
end
end
end
end
return false
end
why this isnt work
local vkeys = require('vkeys')
local ffi = require('ffi')
local getVehiclePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local mainWindowState = imgui.ImBool(false)
local smooth = imgui.ImFloat(0.0)
local radius = imgui.ImFloat(0.6)
local enable = imgui.ImBool(false)
local clistFilter = imgui.ImBool(false)
local visibleCheck = imgui.ImBool(false)
local checkStuned = imgui.ImBool(false)
local checkPause = imgui.ImBool(false)
function main()
repeat wait(0) until isSampAvailable()
lua_thread.create(smooth_aimbot)
while true do
wait(0)
if wasKeyPressed(vkeys.VK_INSERT) then
mainWindowState.v = not mainWindowState.v
end
imgui.Process = mainWindowState.v
end
end
function imgui.OnDrawFrame()
local posX, posY = getScreenResolution()
if mainWindowState.v then
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('Smooth aimbot', mainWindowState)
imgui.SliderFloat('Radius', radius, 0.0, 100.0, '%.1f')
imgui.SliderFloat('Smooth', smooth, 0.0, 50.0, '%.1f')
imgui.Checkbox('Enable', enable)
imgui.Checkbox('VisibleCheck', visibleCheck)
imgui.Checkbox('CheckStuned', checkStuned)
imgui.Checkbox('ClistFilter', clistFilter)
imgui.Checkbox('CheckPause', checkPause)
imgui.End()
end
end
function fix(angle)
if angle > math.pi then
angle = angle - (math.pi * 2)
elseif angle < -math.pi then
angle = angle + (math.pi * 2)
end
return angle
end
function GetNearestVehicle(fov)
local maxDistance = 35
local nearestVehicle = -1
for i = 0, sampGetMaxPlayerId(true) do
if sampIsPlayerConnected(i) then
local find, handle = sampGetVehicleHandleBySampPlayerId(i)
if find then
if isVehicleOnScreen(handle) then
if not isVehicleDead(handle) then
local _, currentID = sampGetPlayerIdByCharHandle(PLAYER_PED)
local vehiclePos = {getVehiclePosition(handle)}
local myPos = {getActiveCameraCoordinates()}
local vector = {myPos[1] - vehiclePos[1], myPos[2] - vehiclePos[2], myPos[3] - vehiclePos[3]}
if isWidescreenOnInOptions() then coefficentZ = 0.0778 else coefficentZ = 0.103 end
local angle = {(math.atan2(vector[2], vector[1]) + 0.04253), (math.atan2((math.sqrt((math.pow(vector[1], 2) + math.pow(vector[2], 2)))), vector[3]) - math.pi / 2 - coefficentZ)}
local view = {fix(representIntAsFloat(readMemory(0xB6F258, 4, false))), fix(representIntAsFloat(readMemory(0xB6F248, 4, false)))}
local distance = math.sqrt((math.pow(angle[1] - view[1], 2) + math.pow(angle[2] - view[2], 2))) * 57.2957795131
if distance > fov then check = true else check = false end
if not check then
local myPos = {getCharCoordinates(PLAYER_PED)}
local distance = math.sqrt((math.pow((vehiclePos[1] - myPos[1]), 2) + math.pow((vehiclePos[2] - myPos[2]), 2) + math.pow((vehiclePos[3] - myPos[3]), 2)))
if (distance < maxDistance) then
nearestVehicle = handle
maxDistance = distance
end
end
end
end
end
end
end
return nearestVehicle
end
function GetBodyPartCoordinates(id, handle)
-- Function to get vehicle coordinates directly
if doesVehicleExist(handle) then
local vehptr = getVehiclePointer(handle)
local vec = ffi.new("float[3]")
getVehiclePosition(ffi.cast("void*", vehptr), vec, id, true)
return vec[0], vec[1], vec[2]
end
end
function smooth_aimbot()
if enable.v and isKeyDown(vkeys.VK_RBUTTON) then
local handle = GetNearestVehicle(radius.v)
if handle ~= -1 then
local _, myID = sampGetPlayerIdByCharHandle(PLAYER_PED)
local result, playerID = sampGetPlayerIdByCharHandle(handle)
if result then
if (checkStuned.v and not CheckStuned()) then return false end
if (clistFilter.v and sampGetPlayerColor(myID) == sampGetPlayerColor(playerID)) then return false end
if (checkPause.v and sampIsPlayerPaused(playerID)) then return false end
local myPos = {getActiveCameraCoordinates()}
local vehiclePos = {GetBodyPartCoordinates(0, handle)} -- Using ID 0 or modify as needed
if not visibleCheck.v or (visibleCheck.v and isLineOfSightClear(myPos[1], myPos[2], myPos[3], vehiclePos[1], vehiclePos[2], vehiclePos[3], true, true, false, true, true)) then
local vector = {myPos[1] - vehiclePos[1], myPos[2] - vehiclePos[2], myPos[3] - vehiclePos[3]}
if isWidescreenOnInOptions() then coefficentZ = 0.0778 else coefficentZ = 0.103 end
local angle = {(math.atan2(vector[2], vector[1]) + 0.04253), (math.atan2((math.sqrt((math.pow(vector[1], 2) + math.pow(vector[2], 2)))), vector[3]) - math.pi / 2 - coefficentZ)}
local view = {fix(representIntAsFloat(readMemory(0xB6F258, 4, false))), fix(representIntAsFloat(readMemory(0xB6F248, 4, false)))}
local difference = {angle[1] - view[1], angle[2] - view[2]}
local smooth = {difference[1] / smooth.v, difference[2] / smooth.v}
setCameraPositionUnfixed((view[2] + smooth[2]), (view[1] + smooth[1]))
end
end
end
end
return false
end
why this isnt work