local config_dir = getWorkingDirectory().."\\config\\saim2022.json" local wm = require("windows.message") local vkeys = require("vkeys") local imgui = require("imgui") local sampev = require("samp.events") local ffi = require("ffi") local memory = require("memory") local vector3d = require("vector3d") local font_flag = require("moonloader").font_flag local font = renderCreateFont("Arial", 12, font_flag.BOLD + font_flag.SHADOW + font_flag.BORDER) local VERSION = "1.0" local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280) ffi.cdef [[ void* __stdcall ShellExecuteA(void* hwnd, const char* op, const char* file, const char* params, const char* dir, int show_cmd); uint32_t __stdcall CoInitializeEx(void*, uint32_t); ]] local shell32 = ffi.load "Shell32" local ole32 = ffi.load "Ole32" ole32.CoInitializeEx(nil, 2 + 4) math.randomseed(os.time()) local menu_item = "Aiming" local last_target = 65535 local shoots = 0 local shoot_log = {} local last_log_size = 0 local info = {} local aim_state = imgui.ImBool(false) local main_window = imgui.ImBool(false) local log_window = imgui.ImBool(false) settings = { initmsg = true, menucmd = "silent", onatstart = false, checkupdates = true, fov = 20, hit = 100, serialmisses = false, preferboneupd = 2, missafter = 4, fromthehip = false, lockactive = false, lockbutton = 0x58, menubutton = 0x55, statebutton = 0x4A, combobutton = 0x0, syncrotation = true, syncaimz = true, smoothaim = false, ignoreobj = false, ignoreveh = false, ignoremyclist = false, ignorebyskin = false, ignorebynick = false, ignored = {}, debug = false, indivfov = false, indivhit = false, wallshot = false, cumbypass = false, minfakeaimdist = 2, maxfakeaimdist = 80, minspread = -0.05, maxspread = 0.05, faketarget = true, maxfaketargetdist = 30, guns = {}, bones = { true, -- chest true, -- stomach false, false, false, false, false, }, load = function() settings.load = nil if not doesFileExist(config_dir) then return end local f = io.open(config_dir, "r") local data = decodeJson(f:read("*a")) f:close() if not data then return end for k, v in pairs(data) do settings[k] = v end aim_state.v = settings.onatstart end, save = function() settings.save = nil for ip, list in pairs(settings.ignored) do if #list.nicks == 0 and #list.skins == 0 then settings.ignored[ip] = nil end end if not doesDirectoryExist(getWorkingDirectory().."\\config") then createDirectory(getWorkingDirectory().."\\config") end local f = io.open(config_dir, "w") f:write(encodeJson(settings)) f:close() end } local weapons = {} function initWeapon(id, name, dist, damage) weapons[id] = { id = id, name = name, dist = dist, damage = damage } end initWeapon(22, "Colt 45", 35.0, 8.25) initWeapon(23, "Silenced 9mm", 35.0, 13.2) initWeapon(24, "Desert Eagle", 35.0, 46.200000762939) initWeapon(25, "Shotgun", 40.0, 30) initWeapon(26, "Sawnoff Shotgun", 35.0, 30) initWeapon(27, "Combat Shotgun", 40.0, 30) initWeapon(28, "Uzi", 35.0, 6.6) initWeapon(29, "MP5", 45.0, 8.25) initWeapon(30, "AK-47", 70.0, 9.900024) initWeapon(31, "M4", 90.0, 9.9000005722046) initWeapon(32, "Tec-9", 35.0, 6.6) initWeapon(33, "Country Rifle", 95.0, 24.750001907349) initWeapon(34, "Sniper Rifle", 320.0, 41) initWeapon(38, "Minigun", 75.0, 46.2) for _, weapon in pairs(weapons) do settings.guns[weapon.name] = { fov = 20, hit = 100 } end local bones = { { dots = { 31 }, name = "Chest" }, { dots = { 2, 41, 51 }, name = "Stomach" }, { dots = { 33, 32, 34, 35 }, name = "Left arm" }, { dots = { 23, 22, 34, 25 }, name = "Right arm" }, { dots = { 42, 43, 44 }, name = "Left leg" }, { dots = { 52, 53, 54 }, name = "Right Leg" }, { dots = { 8, 7 }, name = "Head" } } -- TODO: -- ХИТРЕЙТ В ЗАВИСИМОСТИ ОТ ДИСТАНЦИИ -- ОФФ АИМ НА ПЕРВОЙ ТЫЧКЕ -- НОРМАЛЬНАЯ ЭМУЛЯЦИЯ АИМСИНКА -- КРОВЬ И ТРАССЕРА ( НАХУЙ ? ) function main() if not isSampLoaded() or not isSampfuncsLoaded() then return end repeat wait(100) until isSampAvailable() settings.load() updateIP() selectedweapon = imgui.ImInt(2) maxfaketargetdist = imgui.ImInt(settings.maxfaketargetdist) fov_slider = imgui.ImFloat(settings.fov) hit_slider = imgui.ImFloat(settings.hit) indfovslider = imgui.ImFloat(0.0) skin_slider = imgui.ImInt(0) prefer_bone = imgui.ImInt(getRandomBone()) prefer_bone_upd = imgui.ImInt(settings.preferboneupd) minfakeaimdist = imgui.ImInt(settings.minfakeaimdist) maxfakeaimdist = imgui.ImInt(settings.maxfakeaimdist) minspread = imgui.ImFloat(settings.minspread) maxspread = imgui.ImFloat(settings.maxspread) indhitslider = imgui.ImFloat(0.0) miss_after = imgui.ImInt(settings.missafter) addEventHandler("onWindowMessage", windowMsgHandler) addEventHandler("onScriptTerminate", scriptTerminateHandler) imgui.SwitchContext() local style = imgui.GetStyle() style.WindowRounding = 5.0 local colors = style.Colors local clr = imgui.Col local ImVec4 = imgui.ImVec4 local ImVec2 = imgui.ImVec2 colors[clr.WindowBg] = ImVec4(0.10, 0.1, 0.10, 0.95) colors[clr.TitleBg] = ImVec4(0.10, 0.1, 0.10, 1.00) colors[clr.TitleBgActive] = ImVec4(0.10, 0.1, 0.15, 0.95) colors[clr.ScrollbarBg] = ImVec4(0.10, 0.1, 0.15, 0.95) colors[clr.ScrollbarGrab] = ImVec4(0.60, 0.1, 0.10, 0.50) colors[clr.ScrollbarGrabHovered] = ImVec4(0.60, 0.1, 0.10, 0.65) colors[clr.ScrollbarGrabActive] = ImVec4(0.70, 0.1, 0.10, 0.80) colors[clr.MenuBarBg] = ImVec4(0.10, 0.1, 0.15, 1.00) colors[clr.CloseButton] = ImVec4(0.50, 0.1, 0.10, 0.70) colors[clr.CloseButtonHovered] = ImVec4(0.60, 0.1, 0.10, 1.00) colors[clr.CloseButtonActive] = ImVec4(0.70, 0.1, 0.10, 1.00) colors[clr.CheckMark] = ImVec4(0.85, 0.1, 0.10, 1.00) colors[clr.Button] = ImVec4(0.85, 0.1, 0.10, 0.40) colors[clr.ButtonHovered] = ImVec4(0.85, 0.1, 0.10, 0.55) colors[clr.ButtonActive] = ImVec4(0.85, 0.1, 0.10, 0.70) colors[clr.Header] = ImVec4(0.85, 0.1, 0.10, 0.40) colors[clr.HeaderHovered] = ImVec4(0.85, 0.1, 0.10, 0.55) colors[clr.HeaderActive] = ImVec4(0.85, 0.1, 0.10, 0.70) colors[clr.FrameBg] = ImVec4(0.30, 0.3, 0.30, 0.80) colors[clr.FrameBgHovered] = ImVec4(0.30, 0.3, 0.30, 0.90) colors[clr.FrameBgActive] = ImVec4(0.30, 0.3, 0.30, 1.00) colors[clr.SliderGrab] = ImVec4(0.50, 0.5, 0.50, 1.00) colors[clr.SliderGrabActive] = ImVec4(0.60, 0.6, 0.60, 1.00) writeWallshot() local last_bone_upd = os.clock() if settings.checkupdates then pcall(getAuthorMessage) end if settings.initmsg then sampAddChatMessage(info.initmsg or "Silent AIM loaded. "..(settings.menucmd:len() > 0 and ("Menu - {d9d8d7}/"..settings.menucmd.."{ffffff}. ") or "").."by {3480C7}Rei {ffffff}for {d9d8d7}blast.hk {ffffff}from {d9d8d7}t.me/reiscripts", -1) end while true do legit = nil if not sampIsChatInputActive() and not isSampfuncsConsoleActive() and not sampIsDialogActive() then if isKeyJustPressed(settings.menubutton) and (settings.combobutton == 0 or isKeyDown(settings.combobutton)) then main_window.v = not main_window.v elseif not settings.lockactive and isKeyJustPressed(settings.statebutton) and (settings.combobutton == 0 or isKeyDown(settings.combobutton)) then aim_state.v = not aim_state.v elseif settings.lockactive then aim_state.v = isKeyDown(settings.lockbutton) end end imgui.Process = (main_window.v or log_window.v) if binding and os.clock() - binding.last_upd >= 0.4 then binding.text = (binding.text == "") and "???" or "" binding.last_upd = os.clock() end local weapon = getWeapon() if aim_state.v and weapon then if os.clock() - last_bone_upd >= prefer_bone_upd.v and (isButtonPressed(player, 0) or isButtonPressed(player, 1)) then last_bone_upd = os.clock() prefer_bone.v = getRandomBone() end local sight_2d = getSightPos() local sight_3d = vector3d(convertScreenCoordsToWorld3D(sight_2d.x, sight_2d.y, 1)) local tdist = (settings.indivfov and settings.guns[weapon.name].fov or settings.fov) * 10 if settings.debug then renderDrawPolygon(sight_2d.x, sight_2d.y, tdist * 2, tdist * 2, 50, 0, 0x2000ff00) end local temp_bones = {} for _, dot in ipairs(bones[prefer_bone.v].dots) do table.insert(temp_bones, dot) end if last_bone and not isTableHasValue(temp_bones, last_bone) then table.insert(temp_bones, last_bone) end for k, bone in ipairs(bones) do if k ~= prefer_bone.v then for _, dot in ipairs(bone.dots) do table.insert(temp_bones, dot) end end end if settings.ignoremyclist then local my_color = sampGetPlayerColor(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) end for _, ped in ipairs(getAllChars()) do if ped ~= PLAYER_PED and isCharOnScreen(ped) then local result, id = sampGetPlayerIdByCharHandle(ped) if result then if settings.ignoremyclist then if my_color == sampGetPlayerColor(id) then goto next end end if settings.ignorebynick and isTableHasValue(ignored_nicks, sampGetPlayerNickname(id)) or settings.ignorebyskin and isTableHasValue(ignored_skins, getCharModel(ped)) then goto next end for _, bone in ipairs(temp_bones) do local peds_bone = getBodyPartCoordinates(bone, ped) local bone_2d = vector2d(convert3DCoordsToScreen(peds_bone:get())) local dist_sight = getDistanceBetweenCoords2d(bone_2d.x, bone_2d.y, sight_2d.x, sight_2d.y) local dist = getDistanceBetweenCoords3d(sight_3d.x, sight_3d.y, sight_3d.z, peds_bone:get()) if dist_sight < tdist and dist < weapon.dist and (not legit or legit.dist_sight > dist_sight) and not isCharDead(ped) and not sampIsPlayerPaused(id) and isLineOfSightClear(sight_3d.x, sight_3d.y, sight_3d.z, peds_bone.x, peds_bone.y, peds_bone.z, not settings.ignoreobj, not settings.ignoreveh, false, not settings.ignoreobj, false) then legit = { dist = dist, dist_sight = dist_sight, bone_num = bone, bone = peds_bone, ped = ped, id = id } break end end end end ::next:: end if legit then last_bone = legit.bone_num local player_bone = getBodyPartCoordinates(26, PLAYER_PED) if settings.debug then local tar_2d = vector2d(convert3DCoordsToScreen(legit.bone:get())) renderDrawLine(sight_2d.x, sight_2d.y, tar_2d.x, tar_2d.y, 1, -1) renderDrawBox(tar_2d.x, tar_2d.y, 5, 5, 0xffff0000) renderFontDrawText(font, math.floor(legit.dist_sight), sight_2d.x + 20, sight_2d.y - 15, 0xFFFF0000) end end end wait(0) end end local menu_items = { "Aiming", "Shooting", "Activation", "Misc" } local nick_buff = imgui.ImBuffer("", 64) local skin_buff = imgui.ImInt(0) function imgui.OnDrawFrame() if main_window.v then imgui.ShowCursor = true imgui.SetNextWindowPos(imgui.ImVec2(350.0, 300.0), imgui.Cond.FirstUseEver) imgui.SetNextWindowSize(imgui.ImVec2(450.0, 300.0), imgui.Cond.FirstUseEver) imgui.Begin("", main_window, imgui.WindowFlags.MenuBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse) imgui.BeginMenuBar() imgui.Checkbox("", aim_state) imgui.TextColoredRGB((aim_state.v or settings.lockactive) and "{00FF00}Aim ON " or "{FF0000}Aim OFF") imgui.SameLine() for k, v in ipairs(menu_items) do if imgui.MenuItem(v) then menu_item = v end end imgui.EndMenuBar() imgui.Separator() imgui.Indent(5) if menu_item == "Aiming" then checkbox("Ignore objects", "ignoreobj") checkbox("Ignore vehicles", "ignoreveh") imgui.Newline() imgui.PushItemWidth(150) checkbox("Fake target", "faketarget") if settings.faketarget then if imgui.SliderInt("Max. dist for fake target##maxfaketargetdist", maxfaketargetdist, 0, 200) then settings.maxfaketargetdist = maxfaketargetdist.v end end imgui.Newline() checkbox("Cam bypass", "cumbypass") checkbox("Sync rotation", "syncrotation") checkbox("Sync AimZ", "syncaimz") if settings.syncrotation or settings.syncaimz then if imgui.SliderInt("##minfakeaimdist", minfakeaimdist, 0, 400) then settings.minfakeaimdist = minfakeaimdist.v end imgui.SameLine() imgui.Indent(152) if imgui.SliderInt("##maxfakeaimdist", maxfakeaimdist, 0, 400) then settings.maxfakeaimdist = maxfakeaimdist.v end imgui.Unindent(152) imgui.Text("Min. & Max. distance for fake sync") end imgui.PopItemWidth() imgui.Newline() checkbox("Individual Fov", "indivfov") if settings.indivfov then last_weapon = getWeapon() or last_weapon if last_weapon then indfovslider.v = settings.guns[last_weapon.name].fov if imgui.SliderFloat("Fov##"..last_weapon.id, indfovslider, 0.0, 80.0) then settings.guns[last_weapon.name].fov = indfovslider.v end imgui.TextColoredRGB("{F59B14}Only for "..last_weapon.name) else imgui.Newline() imgui.TextColoredRGB("{F59B14}Get any weapon") imgui.Newline() end else if imgui.SliderFloat("Fov##all", fov_slider, 0.0, 80.00) then settings.fov = fov_slider.v end imgui.Newline() end if imgui.CollapsingHeader("Bones") then local even = false for k, v in ipairs(settings.bones) do if even then imgui.SameLine() imgui.Indent(150) end if imgui.Checkbox(bones[k].name, imgui.ImBool(v)) then settings.bones[k] = not settings.bones[k] end if even then imgui.Unindent(150) end even = not even end imgui.Newline() imgui.Separator() end imgui.Newline() checkbox("Ignore my clist", "ignoremyclist") checkbox("Ignore by nick", "ignorebynick") if settings.ignorebynick then imgui.PushItemWidth(100) imgui.InputText("Nick", nick_buff) imgui.PopItemWidth() if nick_buff.v:len() ~= 0 then nick_buff.v = nick_buff.v:gsub("%%", "") imgui.SameLine() if imgui.Button(nick_buff.v, imgui.ImVec2(imgui.CalcTextSize(nick_buff.v).x + 20, 20)) then tryInsert(ignored_nicks, nick_buff.v) end local nick_lower = nick_buff.v:lower() for id = 0, sampGetMaxPlayerId(false) do if sampIsPlayerConnected(id) then local nick = sampGetPlayerNickname(id) if nick:lower():find(nick_lower) then imgui.SameLine() local button_string = nick.."["..id.."]" if imgui.Button(button_string, imgui.ImVec2(imgui.CalcTextSize(button_string).x + 20, 20)) then tryInsert(ignored_nicks, nick) end break end end end end for k, v in ipairs(ignored_nicks) do if imgui.Button(tostring(v).."##"..k, imgui.ImVec2(160, 20)) then table.remove(ignored_nicks, k) end end imgui.Newline() imgui.Separator() end checkbox("Ignore by skin", "ignorebyskin") if settings.ignorebyskin then imgui.PushItemWidth(80) imgui.InputInt(" ", skin_buff) imgui.PopItemWidth() imgui.SameLine() if imgui.Button("Add") then tryInsert(ignored_skins, skin_buff.v) end imgui.Newline() local items_count = 1 for k, v in ipairs(ignored_skins) do if imgui.Button(tostring(v), imgui.ImVec2(36, 20)) then table.remove(ignored_skins, k) end if items_count % 4 > 0 then imgui.SameLine() end items_count = items_count + 1 end end elseif menu_item == "Shooting" then if imgui.Checkbox("Wallshot", imgui.ImBool(settings.wallshot)) then settings.wallshot = not settings.wallshot writeWallshot() end imgui.Newline() imgui.PushItemWidth(150) if imgui.SliderFloat("##minspread", minspread, -0.15, 0) then settings.minspread = minspread.v end imgui.SameLine() imgui.Indent(152) if imgui.SliderFloat("##maxspread", maxspread, 0, 0.15) then settings.maxspread = maxspread.v end imgui.Unindent(152) imgui.PopItemWidth() imgui.Text("Min. & Max. spread in bone") imgui.Newline() checkbox("Individual Hit", "indivhit") if settings.indivhit then last_weapon = getWeapon() or last_weapon if last_weapon then indhitslider.v = settings.guns[last_weapon.name].hit if imgui.SliderFloat("Hit##"..last_weapon.id, indhitslider, 0.0, 100.0) then settings.guns[last_weapon.name].hit = indhitslider.v end imgui.TextColoredRGB("{F59B14}Only for "..last_weapon.name) else imgui.Newline() imgui.TextColoredRGB("{F59B14}Get any weapon") end else if imgui.SliderFloat("Hit##all", hit_slider, 0.0, 100.00) then settings.hit = hit_slider.v end imgui.Newline() end imgui.Newline() checkbox("Serial misses", "serialmisses") if settings.serialmisses then if imgui.SliderInt("Miss after", miss_after, 0, 100) then settings.missafter = miss_after.v end end imgui.Newline() checkbox("Shoot from the hip", "fromthehip") elseif menu_item == "Activation" then if imgui.Checkbox("Enabled at start", imgui.ImBool(settings.onatstart)) then settings.onatstart = not settings.onatstart end checkbox("Lock activation", "lockactive") imgui.Newline() for k, v in pairs({ lockbutton = "Lock", menubutton = "Menu", statebutton = "State", combobutton = "Combo" }) do imgui.Text(v) imgui.SameLine() imgui.Indent(50) if binding and binding.key == k then imgui.Button(binding.text, imgui.ImVec2(100, 20)) else local key = vkeys.id_to_name(settings[k]) or "" if imgui.Button(key.."##"..k, imgui.ImVec2(100, 20)) then binding = { key = k, last_upd = os.clock(), text = "???" } end end imgui.Unindent(50) end if binding then imgui.Text("ESC - Cancel\nBACKSPACE - Clear") else imgui.TextDisabled("ESC - Cancel\nBACKSPACE - Clear") end elseif menu_item == "Misc" then imgui.BeginChild("Misc1", imgui.ImVec2(140, 220), false) checkbox("Debug mode", "debug") if imgui.Button("Debug log window", imgui.ImVec2(120, 20)) then log_window.v = not log_window.v end if imgui.Button("Clear log", imgui.ImVec2(120, 20)) then shoot_log = {} end imgui.EndChild() imgui.SameLine() imgui.BeginChild("Misc2", imgui.ImVec2(275, 220), false) if info.text then imgui.TextColoredRGB(info.text) end if info.links then imgui.Text("\nLinks:") for _, link in ipairs(info.links) do imgui.Link(link.url, link.caption) end end imgui.EndChild() imgui.Separator() local update_check_result if info.version then if VERSION == info.version then update_check_result = "{00CC00}Script is up to date" else update_check_result = "{F59B14}Version "..info.version.." available" end else update_check_result = "{CC0000}Unable to check for updates" end imgui.TextColoredRGB("v. "..VERSION.." | "..update_check_result) end imgui.End() end if log_window.v then if not main_window.v then imgui.SetMouseCursor(-1) imgui.ShowCursor = false else imgui.ShowCursor = true end local x,y = getCursorPos() imgui.SetNextWindowPos(imgui.ImVec2(x - 150, y - 10), imgui.Cond.FirstUseEver) imgui.SetNextWindowSize(imgui.ImVec2(550, 400), imgui.Cond.FirstUseEver) imgui.Begin(os.date("%d %B %Y", os.time()), log_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse) for k, v in ipairs(shoot_log) do imgui.TextColoredRGB(v) end if #shoot_log > last_log_size then imgui.SetScrollHere() end last_log_size = #shoot_log imgui.End() end end function getCamMode() local aimptr = allocateMemory(31) local _, pid = sampGetPlayerIdByCharHandle(PLAYER_PED) sampStorePlayerAimData(pid, aimptr) local cam_mode = memory.getuint8(aimptr, 0) freeMemory(aimptr) return cam_mode end function sampev.onSendPlayerSync(data) if not aim_state.v then return end local cam_mode = getCamMode() if legit and (cam_mode == 53 or cam_mode == 7 or cam_mode == 55) then sendWeaponSync(legit.id) else sendWeaponSync(65535) end if not legit then return end local weapon = getWeapon() if not weapon then return end if weapon.id == 24 or weapon.id == 26 or weapon.id == 28 or weapon.id == 32 then return end -- +c slide fix if not isButtonPressed(player, 6) then cam_mode = 4 end if not settings.syncrotation or (cam_mode ~= 53 and cam_mode ~= 7) or legit.dist < minfakeaimdist.v or legit.dist > maxfakeaimdist.v then return end local my_bone = getBodyPartCoordinates(23, PLAYER_PED) local b = 0 * math.pi / 360.0 local h = 0 * math.pi / 360.0 local a = getHeadingFromVector2d(legit.bone.x - my_bone.x, legit.bone.y - my_bone.y) * math.pi / 360.0 local c1, c2, c3 = math.cos(h), math.cos(a), math.cos(b) local s1, s2, s3 = math.sin(h), math.sin(a), math.sin(b) data.quaternion[0] = c1 * c2 * c3 - s1 * s2 * s3 data.quaternion[3] = -( c1 * s2 * c3 - s1 * c2 * s3 ) end function sendWeaponSync(id) if last_target == id then return end local weapon = getWeapon() if not weapon then return end local bs = raknetNewBitStream() raknetBitStreamWriteInt8(bs, 204) raknetBitStreamWriteInt16(bs, id) raknetBitStreamWriteInt16(bs, 65535) raknetBitStreamWriteInt8(bs, getWeapontypeSlot(weapon.id)) raknetBitStreamWriteInt8(bs, weapon.id) raknetBitStreamWriteInt16(bs, getAmmoInCharWeapon(PLAYER_PED, weapon.id)) rakne Code local config_dir = getWorkingDirectory().."\\config\\saim2022.json" local wm = require("windows.message") local vkeys = require("vkeys") local imgui = require("imgui") local sampev = require("samp.events") local ffi = require("ffi") local memory = require("memory") local vector3d = require("vector3d") local font_flag = require("moonloader").font_flag local font = renderCreateFont("Arial", 12, font_flag.BOLD + font_flag.SHADOW + font_flag.BORDER) local VERSION = "1.0" local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280) ffi.cdef [[ void* __stdcall ShellExecuteA(void* hwnd, const char* op, const char* file, const char* params, const char* dir, int show_cmd); uint32_t __stdcall CoInitializeEx(void*, uint32_t); ]] local shell32 = ffi.load "Shell32" local ole32 = ffi.load "Ole32" ole32.CoInitializeEx(nil, 2 + 4) math.randomseed(os.time()) local menu_item = "Aiming" local last_target = 65535 local shoots = 0 local shoot_log = {} local last_log_size = 0 local info = {} local aim_state = imgui.ImBool(false) local main_window = imgui.ImBool(false) local log_window = imgui.ImBool(false) settings = { initmsg = true, menucmd = "silent", onatstart = false, checkupdates = true, fov = 20, hit = 100, serialmisses = false, preferboneupd = 2, missafter = 4, fromthehip = false, lockactive = false, lockbutton = 0x58, menubutton = 0x55, statebutton = 0x4A, combobutton = 0x0, syncrotation = true, syncaimz = true, smoothaim = false, ignoreobj = false, ignoreveh = false, ignoremyclist = false, ignorebyskin = false, ignorebynick = false, ignored = {}, debug = false, indivfov = false, indivhit = false, wallshot = false, cumbypass = false, minfakeaimdist = 2, maxfakeaimdist = 80, minspread = -0.05, maxspread = 0.05, faketarget = true, maxfaketargetdist = 30, guns = {}, bones = { true, -- chest true, -- stomach false, false, false, false, false, }, load = function() settings.load = nil if not doesFileExist(config_dir) then return end local f = io.open(config_dir, "r") local data = decodeJson(f:read("*a")) f:close() if not data then return end for k, v in pairs(data) do settings[k] = v end aim_state.v = settings.onatstart end, save = function() settings.save = nil for ip, list in pairs(settings.ignored) do if #list.nicks == 0 and #list.skins == 0 then settings.ignored[ip] = nil end end if not doesDirectoryExist(getWorkingDirectory().."\\config") then createDirectory(getWorkingDirectory().."\\config") end local f = io.open(config_dir, "w") f:write(encodeJson(settings)) f:close() end } local weapons = {} function initWeapon(id, name, dist, damage) weapons[id] = { id = id, name = name, dist = dist, damage = damage } end initWeapon(22, "Colt 45", 35.0, 8.25) initWeapon(23, "Silenced 9mm", 35.0, 13.2) initWeapon(24, "Desert Eagle", 35.0, 46.200000762939) initWeapon(25, "Shotgun", 40.0, 30) initWeapon(26, "Sawnoff Shotgun", 35.0, 30) initWeapon(27, "Combat Shotgun", 40.0, 30) initWeapon(28, "Uzi", 35.0, 6.6) initWeapon(29, "MP5", 45.0, 8.25) initWeapon(30, "AK-47", 70.0, 9.900024) initWeapon(31, "M4", 90.0, 9.9000005722046) initWeapon(32, "Tec-9", 35.0, 6.6) initWeapon(33, "Country Rifle", 95.0, 24.750001907349) initWeapon(34, "Sniper Rifle", 320.0, 41) initWeapon(38, "Minigun", 75.0, 46.2) for _, weapon in pairs(weapons) do settings.guns[weapon.name] = { fov = 20, hit = 100 } end local bones = { { dots = { 31 }, name = "Chest" }, { dots = { 2, 41, 51 }, name = "Stomach" }, { dots = { 33, 32, 34, 35 }, name = "Left arm" }, { dots = { 23, 22, 34, 25 }, name = "Right arm" }, { dots = { 42, 43, 44 }, name = "Left leg" }, { dots = { 52, 53, 54 }, name = "Right Leg" }, { dots = { 8, 7 }, name = "Head" } } -- TODO: -- ХИТРЕЙТ В ЗАВИСИМОСТИ ОТ ДИСТАНЦИИ -- ОФФ АИМ НА ПЕРВОЙ ТЫЧКЕ -- НОРМАЛЬНАЯ ЭМУЛЯЦИЯ АИМСИНКА -- КРОВЬ И ТРАССЕРА ( НАХУЙ ? ) function main() if not isSampLoaded() or not isSampfuncsLoaded() then return end repeat wait(100) until isSampAvailable() settings.load() updateIP() selectedweapon = imgui.ImInt(2) maxfaketargetdist = imgui.ImInt(settings.maxfaketargetdist) fov_slider = imgui.ImFloat(settings.fov) hit_slider = imgui.ImFloat(settings.hit) indfovslider = imgui.ImFloat(0.0) skin_slider = imgui.ImInt(0) prefer_bone = imgui.ImInt(getRandomBone()) prefer_bone_upd = imgui.ImInt(settings.preferboneupd) minfakeaimdist = imgui.ImInt(settings.minfakeaimdist) maxfakeaimdist = imgui.ImInt(settings.maxfakeaimdist) minspread = imgui.ImFloat(settings.minspread) maxspread = imgui.ImFloat(settings.maxspread) indhitslider = imgui.ImFloat(0.0) miss_after = imgui.ImInt(settings.missafter) addEventHandler("onWindowMessage", windowMsgHandler) addEventHandler("onScriptTerminate", scriptTerminateHandler) imgui.SwitchContext() local style = imgui.GetStyle() style.WindowRounding = 5.0 local colors = style.Colors local clr = imgui.Col local ImVec4 = imgui.ImVec4 local ImVec2 = imgui.ImVec2 colors[clr.WindowBg] = ImVec4(0.10, 0.1, 0.10, 0.95) colors[clr.TitleBg] = ImVec4(0.10, 0.1, 0.10, 1.00) colors[clr.TitleBgActive] = ImVec4(0.10, 0.1, 0.15, 0.95) colors[clr.ScrollbarBg] = ImVec4(0.10, 0.1, 0.15, 0.95) colors[clr.ScrollbarGrab] = ImVec4(0.60, 0.1, 0.10, 0.50) colors[clr.ScrollbarGrabHovered] = ImVec4(0.60, 0.1, 0.10, 0.65) colors[clr.ScrollbarGrabActive] = ImVec4(0.70, 0.1, 0.10, 0.80) colors[clr.MenuBarBg] = ImVec4(0.10, 0.1, 0.15, 1.00) colors[clr.CloseButton] = ImVec4(0.50, 0.1, 0.10, 0.70) colors[clr.CloseButtonHovered] = ImVec4(0.60, 0.1, 0.10, 1.00) colors[clr.CloseButtonActive] = ImVec4(0.70, 0.1, 0.10, 1.00) colors[clr.CheckMark] = ImVec4(0.85, 0.1, 0.10, 1.00) colors[clr.Button] = ImVec4(0.85, 0.1, 0.10, 0.40) colors[clr.ButtonHovered] = ImVec4(0.85, 0.1, 0.10, 0.55) colors[clr.ButtonActive] = ImVec4(0.85, 0.1, 0.10, 0.70) colors[clr.Header] = ImVec4(0.85, 0.1, 0.10, 0.40) colors[clr.HeaderHovered] = ImVec4(0.85, 0.1, 0.10, 0.55) colors[clr.HeaderActive] = ImVec4(0.85, 0.1, 0.10, 0.70) colors[clr.FrameBg] = ImVec4(0.30, 0.3, 0.30, 0.80) colors[clr.FrameBgHovered] = ImVec4(0.30, 0.3, 0.30, 0.90) colors[clr.FrameBgActive] = ImVec4(0.30, 0.3, 0.30, 1.00) colors[clr.SliderGrab] = ImVec4(0.50, 0.5, 0.50, 1.00) colors[clr.SliderGrabActive] = ImVec4(0.60, 0.6, 0.60, 1.00) writeWallshot() local last_bone_upd = os.clock() if settings.checkupdates then pcall(getAuthorMessage) end if settings.initmsg then sampAddChatMessage(info.initmsg or "Silent AIM loaded. "..(settings.menucmd:len() > 0 and ("Menu - {d9d8d7}/"..settings.menucmd.."{ffffff}. ") or "").."by {3480C7}Rei {ffffff}for {d9d8d7}blast.hk {ffffff}from {d9d8d7}t.me/reiscripts", -1) end while true do legit = nil if not sampIsChatInputActive() and not isSampfuncsConsoleActive() and not sampIsDialogActive() then if isKeyJustPressed(settings.menubutton) and (settings.combobutton == 0 or isKeyDown(settings.combobutton)) then main_window.v = not main_window.v elseif not settings.lockactive and isKeyJustPressed(settings.statebutton) and (settings.combobutton == 0 or isKeyDown(settings.combobutton)) then aim_state.v = not aim_state.v elseif settings.lockactive then aim_state.v = isKeyDown(settings.lockbutton) end end imgui.Process = (main_window.v or log_window.v) if binding and os.clock() - binding.last_upd >= 0.4 then binding.text = (binding.text == "") and "???" or "" binding.last_upd = os.clock() end local weapon = getWeapon() if aim_state.v and weapon then if os.clock() - last_bone_upd >= prefer_bone_upd.v and (isButtonPressed(player, 0) or isButtonPressed(player, 1)) then last_bone_upd = os.clock() prefer_bone.v = getRandomBone() end local sight_2d = getSightPos() local sight_3d = vector3d(convertScreenCoordsToWorld3D(sight_2d.x, sight_2d.y, 1)) local tdist = (settings.indivfov and settings.guns[weapon.name].fov or settings.fov) * 10 if settings.debug then renderDrawPolygon(sight_2d.x, sight_2d.y, tdist * 2, tdist * 2, 50, 0, 0x2000ff00) end local temp_bones = {} for _, dot in ipairs(bones[prefer_bone.v].dots) do table.insert(temp_bones, dot) end if last_bone and not isTableHasValue(temp_bones, last_bone) then table.insert(temp_bones, last_bone) end for k, bone in ipairs(bones) do if k ~= prefer_bone.v then for _, dot in ipairs(bone.dots) do table.insert(temp_bones, dot) end end end if settings.ignoremyclist then local my_color = sampGetPlayerColor(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) end for _, ped in ipairs(getAllChars()) do if ped ~= PLAYER_PED and isCharOnScreen(ped) then local result, id = sampGetPlayerIdByCharHandle(ped) if result then if settings.ignoremyclist then if my_color == sampGetPlayerColor(id) then goto next end end if settings.ignorebynick and isTableHasValue(ignored_nicks, sampGetPlayerNickname(id)) or settings.ignorebyskin and isTableHasValue(ignored_skins, getCharModel(ped)) then goto next end for _, bone in ipairs(temp_bones) do local peds_bone = getBodyPartCoordinates(bone, ped) local bone_2d = vector2d(convert3DCoordsToScreen(peds_bone:get())) local dist_sight = getDistanceBetweenCoords2d(bone_2d.x, bone_2d.y, sight_2d.x, sight_2d.y) local dist = getDistanceBetweenCoords3d(sight_3d.x, sight_3d.y, sight_3d.z, peds_bone:get()) if dist_sight < tdist and dist < weapon.dist and (not legit or legit.dist_sight > dist_sight) and not isCharDead(ped) and not sampIsPlayerPaused(id) and isLineOfSightClear(sight_3d.x, sight_3d.y, sight_3d.z, peds_bone.x, peds_bone.y, peds_bone.z, not settings.ignoreobj, not settings.ignoreveh, false, not settings.ignoreobj, false) then legit = { dist = dist, dist_sight = dist_sight, bone_num = bone, bone = peds_bone, ped = ped, id = id } break end end end end ::next:: end if legit then last_bone = legit.bone_num local player_bone = getBodyPartCoordinates(26, PLAYER_PED) if settings.debug then local tar_2d = vector2d(convert3DCoordsToScreen(legit.bone:get())) renderDrawLine(sight_2d.x, sight_2d.y, tar_2d.x, tar_2d.y, 1, -1) renderDrawBox(tar_2d.x, tar_2d.y, 5, 5, 0xffff0000) renderFontDrawText(font, math.floor(legit.dist_sight), sight_2d.x + 20, sight_2d.y - 15, 0xFFFF0000) end end end wait(0) end end local menu_items = { "Aiming", "Shooting", "Activation", "Misc" } local nick_buff = imgui.ImBuffer("", 64) local skin_buff = imgui.ImInt(0) function imgui.OnDrawFrame() if main_window.v then imgui.ShowCursor = true imgui.SetNextWindowPos(imgui.ImVec2(350.0, 300.0), imgui.Cond.FirstUseEver) imgui.SetNextWindowSize(imgui.ImVec2(450.0, 300.0), imgui.Cond.FirstUseEver) imgui.Begin("", main_window, imgui.WindowFlags.MenuBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse) imgui.BeginMenuBar() imgui.Checkbox("", aim_state) imgui.TextColoredRGB((aim_state.v or settings.lockactive) and "{00FF00}Aim ON " or "{FF0000}Aim OFF") imgui.SameLine() for k, v in ipairs(menu_items) do if imgui.MenuItem(v) then menu_item = v end end imgui.EndMenuBar() imgui.Separator() imgui.Indent(5) if menu_item == "Aiming" then checkbox("Ignore objects", "ignoreobj") checkbox("Ignore vehicles", "ignoreveh") imgui.Newline() imgui.PushItemWidth(150) checkbox("Fake target", "faketarget") if settings.faketarget then if imgui.SliderInt("Max. dist for fake target##maxfaketargetdist", maxfaketargetdist, 0, 200) then settings.maxfaketargetdist = maxfaketargetdist.v end end imgui.Newline() checkbox("Cam bypass", "cumbypass") checkbox("Sync rotation", "syncrotation") checkbox("Sync AimZ", "syncaimz") if settings.syncrotation or settings.syncaimz then if imgui.SliderInt("##minfakeaimdist", minfakeaimdist, 0, 400) then settings.minfakeaimdist = minfakeaimdist.v end imgui.SameLine() imgui.Indent(152) if imgui.SliderInt("##maxfakeaimdist", maxfakeaimdist, 0, 400) then settings.maxfakeaimdist = maxfakeaimdist.v end imgui.Unindent(152) imgui.Text("Min. & Max. distance for fake sync") end imgui.PopItemWidth() imgui.Newline() checkbox("Individual Fov", "indivfov") if settings.indivfov then last_weapon = getWeapon() or last_weapon if last_weapon then indfovslider.v = settings.guns[last_weapon.name].fov if imgui.SliderFloat("Fov##"..last_weapon.id, indfovslider, 0.0, 80.0) then settings.guns[last_weapon.name].fov = indfovslider.v end imgui.TextColoredRGB("{F59B14}Only for "..last_weapon.name) else imgui.Newline() imgui.TextColoredRGB("{F59B14}Get any weapon") imgui.Newline() end else if imgui.SliderFloat("Fov##all", fov_slider, 0.0, 80.00) then settings.fov = fov_slider.v end imgui.Newline() end if imgui.CollapsingHeader("Bones") then local even = false for k, v in ipairs(settings.bones) do if even then imgui.SameLine() imgui.Indent(150) end if imgui.Checkbox(bones[k].name, imgui.ImBool(v)) then settings.bones[k] = not settings.bones[k] end if even then imgui.Unindent(150) end even = not even end imgui.Newline() imgui.Separator() end imgui.Newline() checkbox("Ignore my clist", "ignoremyclist") checkbox("Ignore by nick", "ignorebynick") if settings.ignorebynick then imgui.PushItemWidth(100) imgui.InputText("Nick", nick_buff) imgui.PopItemWidth() if nick_buff.v:len() ~= 0 then nick_buff.v = nick_buff.v:gsub("%%", "") imgui.SameLine() if imgui.Button(nick_buff.v, imgui.ImVec2(imgui.CalcTextSize(nick_buff.v).x + 20, 20)) then tryInsert(ignored_nicks, nick_buff.v) end local nick_lower = nick_buff.v:lower() for id = 0, sampGetMaxPlayerId(false) do if sampIsPlayerConnected(id) then local nick = sampGetPlayerNickname(id) if nick:lower():find(nick_lower) then imgui.SameLine() local button_string = nick.."["..id.."]" if imgui.Button(button_string, imgui.ImVec2(imgui.CalcTextSize(button_string).x + 20, 20)) then tryInsert(ignored_nicks, nick) end break end end end end for k, v in ipairs(ignored_nicks) do if imgui.Button(tostring(v).."##"..k, imgui.ImVec2(160, 20)) then table.remove(ignored_nicks, k) end end imgui.Newline() imgui.Separator() end checkbox("Ignore by skin", "ignorebyskin") if settings.ignorebyskin then imgui.PushItemWidth(80) imgui.InputInt(" ", skin_buff) imgui.PopItemWidth() imgui.SameLine() if imgui.Button("Add") then tryInsert(ignored_skins, skin_buff.v) end imgui.Newline() local items_count = 1 for k, v in ipairs(ignored_skins) do if imgui.Button(tostring(v), imgui.ImVec2(36, 20)) then table.remove(ignored_skins, k) end if items_count % 4 > 0 then imgui.SameLine() end items_count = items_count + 1 end end elseif menu_item == "Shooting" then if imgui.Checkbox("Wallshot", imgui.ImBool(settings.wallshot)) then settings.wallshot = not settings.wallshot writeWallshot() end imgui.Newline() imgui.PushItemWidth(150) if imgui.SliderFloat("##minspread", minspread, -0.15, 0) then settings.minspread = minspread.v end imgui.SameLine() imgui.Indent(152) if imgui.SliderFloat("##maxspread", maxspread, 0, 0.15) then settings.maxspread = maxspread.v end imgui.Unindent(152) imgui.PopItemWidth() imgui.Text("Min. & Max. spread in bone") imgui.Newline() checkbox("Individual Hit", "indivhit") if settings.indivhit then last_weapon = getWeapon() or last_weapon if last_weapon then indhitslider.v = settings.guns[last_weapon.name].hit if imgui.SliderFloat("Hit##"..last_weapon.id, indhitslider, 0.0, 100.0) then settings.guns[last_weapon.name].hit = indhitslider.v end imgui.TextColoredRGB("{F59B14}Only for "..last_weapon.name) else imgui.Newline() imgui.TextColoredRGB("{F59B14}Get any weapon") end else if imgui.SliderFloat("Hit##all", hit_slider, 0.0, 100.00) then settings.hit = hit_slider.v end imgui.Newline() end imgui.Newline() checkbox("Serial misses", "serialmisses") if settings.serialmisses then if imgui.SliderInt("Miss after", miss_after, 0, 100) then settings.missafter = miss_after.v end end imgui.Newline() checkbox("Shoot from the hip", "fromthehip") elseif menu_item == "Activation" then if imgui.Checkbox("Enabled at start", imgui.ImBool(settings.onatstart)) then settings.onatstart = not settings.onatstart end checkbox("Lock activation", "lockactive") imgui.Newline() for k, v in pairs({ lockbutton = "Lock", menubutton = "Menu", statebutton = "State", combobutton = "Combo" }) do imgui.Text(v) imgui.SameLine() imgui.Indent(50) if binding and binding.key == k then imgui.Button(binding.text, imgui.ImVec2(100, 20)) else local key = vkeys.id_to_name(settings[k]) or "" if imgui.Button(key.."##"..k, imgui.ImVec2(100, 20)) then binding = { key = k, last_upd = os.clock(), text = "???" } end end imgui.Unindent(50) end if binding then imgui.Text("ESC - Cancel\nBACKSPACE - Clear") else imgui.TextDisabled("ESC - Cancel\nBACKSPACE - Clear") end elseif menu_item == "Misc" then imgui.BeginChild("Misc1", imgui.ImVec2(140, 220), false) checkbox("Debug mode", "debug") if imgui.Button("Debug log window", imgui.ImVec2(120, 20)) then log_window.v = not log_window.v end if imgui.Button("Clear log", imgui.ImVec2(120, 20)) then shoot_log = {} end imgui.EndChild() imgui.SameLine() imgui.BeginChild("Misc2", imgui.ImVec2(275, 220), false) if info.text then imgui.TextColoredRGB(info.text) end if info.links then imgui.Text("\nLinks:") for _, link in ipairs(info.links) do imgui.Link(link.url, link.caption) end end imgui.EndChild() imgui.Separator() local update_check_result if info.version then if VERSION == info.version then update_check_result = "{00CC00}Script is up to date" else update_check_result = "{F59B14}Version "..info.version.." available" end else update_check_result = "{CC0000}Unable to check for updates" end imgui.TextColoredRGB("v. "..VERSION.." | "..update_check_result) end imgui.End() end if log_window.v then if not main_window.v then imgui.SetMouseCursor(-1) imgui.ShowCursor = false else imgui.ShowCursor = true end local x,y = getCursorPos() imgui.SetNextWindowPos(imgui.ImVec2(x - 150, y - 10), imgui.Cond.FirstUseEver) imgui.SetNextWindowSize(imgui.ImVec2(550, 400), imgui.Cond.FirstUseEver) imgui.Begin(os.date("%d %B %Y", os.time()), log_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse) for k, v in ipairs(shoot_log) do imgui.TextColoredRGB(v) end if #shoot_log > last_log_size then imgui.SetScrollHere() end last_log_size = #shoot_log imgui.End() end end function getCamMode() local aimptr = allocateMemory(31) local _, pid = sampGetPlayerIdByCharHandle(PLAYER_PED) sampStorePlayerAimData(pid, aimptr) local cam_mode = memory.getuint8(aimptr, 0) freeMemory(aimptr) return cam_mode end function sampev.onSendPlayerSync(data) if not aim_state.v then return end local cam_mode = getCamMode() if legit and (cam_mode == 53 or cam_mode == 7 or cam_mode == 55) then sendWeaponSync(legit.id) else sendWeaponSync(65535) end if not legit then return end local weapon = getWeapon() if not weapon then return end if weapon.id == 24 or weapon.id == 26 or weapon.id == 28 or weapon.id == 32 then return end -- +c slide fix if not isButtonPressed(player, 6) then cam_mode = 4 end if not settings.syncrotation or (cam_mode ~= 53 and cam_mode ~= 7) or legit.dist < minfakeaimdist.v or legit.dist > maxfakeaimdist.v then return end local my_bone = getBodyPartCoordinates(23, PLAYER_PED) local b = 0 * math.pi / 360.0 local h = 0 * math.pi / 360.0 local a = getHeadingFromVector2d(legit.bone.x - my_bone.x, legit.bone.y - my_bone.y) * math.pi / 360.0 local c1, c2, c3 = math.cos(h), math.cos(a), math.cos(b) local s1, s2, s3 = math.sin(h), math.sin(a), math.sin(b) data.quaternion[0] = c1 * c2 * c3 - s1 * s2 * s3 data.quaternion[3] = -( c1 * s2 * c3 - s1 * c2 * s3 ) end function sendWeaponSync(id) if last_target == id then return end local weapon = getWeapon() if not weapon then return end local bs = raknetNewBitStream() raknetBitStreamWriteInt8(bs, 204) raknetBitStreamWriteInt16(bs, id) raknetBitStreamWriteInt16(bs, 65535) raknetBitStreamWriteInt8(bs, getWeapontypeSlot(weapon.id)) raknetBitStreamWriteInt8(bs, weapon.id) raknetBitStreamWriteInt16(bs, getAmmoInCharWeapon(PLAYER_PED, weapon.id)) rakne Что не так? [13:23:32.679408] (error) saim2022.lua: ...ль\Desktop\GTA 140K BY DAPO SHOW\moonloader\saim2022.lua:11: attempt to index local 'font_flag' (a nil value) stack traceback:
хочешь использовать font_flag, но он не имеет значения замени 10 строку на: local font_flag = require("moonloader").font_flags