- 283
- 90
- Версия MoonLoader
- .026-beta
Сделал скрипт.
Скрипт не работает, активирую чекбокс, а он не крашит, крч ничего не делает. Никаких ошибок и работы скрипта нет
Lua:
local imgui = require('imgui')
local sampev = require('lib.samp.events')
local memory = require('memory')
local key = require('vkeys')
local ffi = require('ffi')
local inicfg = require 'inicfg'
local directIni = "moonloader\\config\\cheat.ini"
local mainIni = inicfg.load(nil, directIni)
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local getbonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local mainIni = inicfg.load({
config =
{
fast_exit = false,
lines = false,
}
}, "cheat.ini")
if not doesFileExist('moonloader/config/cheat.ini') then
inicfg.save(mainIni, 'cheat.ini')
end
--window
local window = imgui.ImBool(false)
--menu
menu = 1
--checkbox
local fast_exit = imgui.ImBool(false)
local lines = imgui.ImBool(false)
--slider
speed_set = imgui.ImInt(25)
dist__tp = imgui.ImInt(0)
delay__tp = imgui.ImInt(0)
--config checkbox
local fast_exit = imgui.ImBool(mainIni.config.fast_exit)
local lines = imgui.ImBool(mainIni.config.lines)
function main()
while not isSampAvailable() do wait(0) end
sampAddChatMessage(' --------------------------------- ', -1)
sampAddChatMessage(' ', -1)
sampAddChatMessage(' loaded.', -1)
sampAddChatMessage(' ', -1)
sampAddChatMessage(' --------------------------------- ', -1)
imgui.Process = false
sampRegisterChatCommand('qn', function()
window.v = not window.v
end)
while true do
wait(0)
imgui.Process = window.v
if fast_exit.v then
if isKeyJustPressed(VK_F) then
if isCharInAnyCar(PLAYER_PED) then
local car = storeCarCharIsInNoSave(PLAYER_PED)
local speed = getCarSpeed(car)
clearCharTasksImmediately(PLAYER_PED)
local pos = {getCharCoordinates(PLAYER_PED)}
setCharCoordinates(PLAYER_PED, pos[1], pos[2], pos[3] + 2)
end
end
end
if lines.v then
local myPosScreen = {convert3DCoordsToScreen(GetBodyPartCoordinates(3, PLAYER_PED))}
local enPosScreen = {convert3DCoordsToScreen(GetBodyPartCoordinates(3, handle))}
renderDrawLine(myPosScreen[1], myPosScreen[2], enPosScreen[1], enPosScreen[2], 1, color)
end
end
end
function imgui.OnDrawFrame()
if window.v then
imgui.SetNextWindowPos(imgui.ImVec2(350.0, 250.0), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(500.0, 175.0), imgui.Cond.FirstUseEver)
imgui.Begin('cheat', window, imgui.WindowFlags.NoResize, imgui.WindowFlags.ShowBorders)
imgui.BeginChild('##menu__item', imgui.ImVec2(82, 135), true)
if imgui.Button('Main', imgui.ImVec2(66, 27)) then
menu = 1
end
if imgui.Button('AimBot', imgui.ImVec2(66, 27)) then
menu = 2
end
if imgui.Button('Coord', imgui.ImVec2(66, 27)) then
menu = 3
end
if imgui.Button('Other', imgui.ImVec2(66, 27)) then
menu = 4
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild('##elements', imgui.ImVec2(400, 135), true)
--menu
if imgui.Checkbox('Fast Exit', fast_exit) then
mainIni.config.fast_exit = fast_exit.v
inicfg.save(mainIni, 'cheat.ini')
end
end
if menu == 2 then
end
if menu == 3 then
imgui.Text("Teleport Distance:")
imgui.PushItemWidth(180.0)
imgui.SliderInt("Distance", dist__tp, 0, 300)
imgui.PopItemWidth()
imgui.Text("Teleport Delay:")
imgui.PushItemWidth(180.0)
imgui.SliderInt("Delay", delay__tp, 0, 600)
imgui.PopItemWidth()
if imgui.Button("Teleport", (imgui.ImVec2(180, 27))) then
local result, x, y, z = getTargetBlipCoordinates()
if result and not coord_master then
lua_thread.create(function()
coord_master = true
freezeCharPosition(PLAYER_PED, true)
CoordMaster(x, y, z, dist__tp.v, delay__tp.v)
freezeCharPosition(PLAYER_PED, false)
coord_master = false
end)
end
end
end
if menu == 4 then
if imgui.Checkbox('Lines', lines) then
mainIni.config.lines = lines.v
inicfg.save(mainIni, 'cheat.ini')
end
end
imgui.EndChild()
imgui.End()
end
end
function ShowMessage(text, title, style)
ffi.cdef [[
int MessageBoxA(
void* hWnd,
const char* lpText,
const char* lpCaption,
unsigned int uType
);
]]
local hwnd = ffi.cast('void*', readMemory(0x00C8CF88, 4, false))
ffi.C.MessageBoxA(hwnd, text, title, style and (style + 0x50000) or 0x50000)
end
function imgui.CenterText(text)
imgui.SetCursorPosX(imgui.GetWindowSize().x / 2 - imgui.CalcTextSize(text).x / 2)
imgui.Text(text)
end
function imgui.Hint(text, delay, action)
if imgui.IsItemHovered() then
if go_hint == nil then go_hint = os.clock() + (delay and delay or 0.0) end
local alpha = (os.clock() - go_hint) * 5
if os.clock() >= go_hint then
imgui.PushStyleVar(imgui.StyleVar.WindowPadding, imgui.ImVec2(10, 10))
imgui.PushStyleVar(imgui.StyleVar.Alpha, (alpha <= 1.0 and alpha or 1.0))
imgui.PushStyleColor(imgui.Col.PopupBg, imgui.ImVec4(0.11, 0.11, 0.11, 1.00))
imgui.BeginTooltip()
imgui.PushTextWrapPos(450)
imgui.TextColored(imgui.GetStyle().Colors[imgui.Col.ButtonHovered], u8'Подсказка:')
imgui.TextUnformatted(text)
if action ~= nil then
imgui.TextColored(imgui.GetStyle().Colors[imgui.Col.TextDisabled], '\n '..action)
end
if not imgui.IsItemVisible() and imgui.GetStyle().Alpha == 1.0 then go_hint = nil end
imgui.PopTextWrapPos()
imgui.EndTooltip()
imgui.PopStyleColor()
imgui.PopStyleVar(2)
end
end
end
function CoordMaster(px, py, pz, step, time)
local x, y, z = getCharCoordinates(PLAYER_PED)
local d = getDistanceBetweenCoords3d(px, py, pz, x, y, z)
if d <= step then
setCharCoordinates(PLAYER_PED, px, py, pz)
else
local dx, dy, dz = px - x, py - y, pz - z
x = x + step / d * dx
y = y + step / d * dy
z = z + step / d * dz
setCharCoordinates(PLAYER_PED, x, y, z)
wait(time)
CoordMaster(px, py, pz, step, time)
end
end
function GetBodyPartCoordinates(id, handle)
if doesCharExist(handle) then
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
end
Скрипт не работает, активирую чекбокс, а он не крашит, крч ничего не делает. Никаких ошибок и работы скрипта нет