local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
-- Конфигурационные Таблицы
local Config = {
window = imgui.ImBool(false),
checkboxes = {
coordMaster = imgui.ImBool(false),
blipFinder = imgui.ImBool(false),
markerFinder = imgui.ImBool(false),
govnovoz = imgui.ImBool(false),
inCar = imgui.ImBool(false),
},
texts = {
coordMaster = 'Глобальное управление координатами выключено',
blipFinder = 'Поиск блипов выключен',
markerFinder = 'Поиск маркеров выключен',
govnovoz = 'Govnovoz выключен',
inCar = 'В машине отключено',
},
position = {
x = imgui.ImBuffer(128),
y = imgui.ImBuffer(128),
z = imgui.ImBuffer(128)
},
sliders = {
stepDistance = imgui.ImInt(5),
stepDelay = imgui.ImInt(1000),
markerDistance = imgui.ImInt(100),
visotaGovnovoz = imgui.ImInt(100)
}
}
-- Вспомогательные Функции
local function toggleInterface()
Config.window.v = not Config.window.v
end
local function updateText(checkbox, textKey)
Config.texts[textKey] = checkbox.v and 'Включено' or 'Выключено'
end
local function getNumericPosition()
return tonumber(Config.position.x.v) or 0.0,
tonumber(Config.position.y.v) or 0.0,
tonumber(Config.position.z.v) or 0.0
end
local function setPlayerCoordinates(x, y, z)
setCharCoordinates(PLAYER_PED, x, y, z)
end
local function printDebug()
print('Отладочная информация')
end
-- Функции Телепортации Без createSyncData
local function teleportPlayer(playerPed, targetX, targetY, targetZ, stepDistance, stepDelay)
lua_thread.create(function()
local currentX, currentY, currentZ = getCharCoordinates(playerPed)
local groundZ = getGroundZFor3dCoord(targetX, targetY, targetZ)
local deltaX = (targetX - currentX) / stepDistance
local deltaY = (targetY - currentY) / stepDistance
local deltaZ = (groundZ - currentZ) / stepDistance
for i = 1, stepDistance do
currentX = currentX + deltaX
currentY = currentY + deltaY
currentZ = currentZ + deltaZ
setPlayerCoordinates(playerPed, currentX, currentY, currentZ)
wait(stepDelay)
end
end)
end
-- Функции Маркеров и Блипов
local function searchMarkers(posX, posY, posZ, radius, isRace)
local baseAddress = isRace and 0xC7F168 or 0xC7DD88
local markerStructSize = isRace and 56 or 160
local closest = {distance = radius, x = 0.0, y = 0.0, z = 0.0}
for id = 0, 31 do
local markerAddress = baseAddress + id * markerStructSize
local markerX = representIntAsFloat(readMemory(markerAddress, 4, false))
local markerY = representIntAsFloat(readMemory(markerAddress + 4, 4, false))
local markerZ = representIntAsFloat(readMemory(markerAddress + 8, 4, false))
if markerX ~= 0.0 or markerY ~= 0.0 or markerZ ~= 0.0 then
local distance = getDistanceBetweenCoords3d(markerX, markerY, markerZ, posX, posY, posZ)
if distance < closest.distance then
closest = {distance = distance, x = markerX, y = markerY, z = markerZ}
end
end
end
if closest.distance < radius then
return true, closest.x, closest.y, closest.z
end
return false, 0.0, 0.0, 0.0
end
local function getBlipCoordinates()
local success, x, y, z = getTargetBlipCoordinates()
if not success then return false end
requestCollision(x, y)
loadScene(x, y, z)
success, x, y, z = getTargetBlipCoordinates()
return success, x, y, z
end
-- Пользовательские Стиль и Цвета
local function setCustomStyle()
imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(0.1, 0.1, 0.1, 1.0)) -- Темный фон окна
imgui.PushStyleColor(imgui.Col.Header, imgui.ImVec4(0.2, 0.2, 0.8, 1.0)) -- Голубой заголовок
imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.2, 0.6, 0.2, 1.0)) -- Зеленые кнопки
imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.3, 0.7, 0.3, 1.0))
imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.1, 0.8, 0.1, 1.0))
imgui.PushStyleVar(imgui.StyleVar.WindowRounding, 10.0)
imgui.PushStyleVar(imgui.StyleVar.FrameRounding, 5.0)
imgui.PushStyleVar(imgui.StyleVar.GrabRounding, 5.0)
end
local function resetStyle()
imgui.PopStyleVar(3)
imgui.PopStyleColor(5)
end
-- Пользовательские Виджеты
local function CustomCheckbox(label, checkbox, textKey, tooltip)
-- Рисуем собственный чекбокс
imgui.BeginGroup()
imgui.PushStyleColor(imgui.Col.CheckMark, imgui.ImVec4(1.0, 1.0, 1.0, 1.0))
if imgui.Checkbox('', checkbox) then
updateText(checkbox, textKey)
end
imgui.PopStyleColor(1)
imgui.SameLine()
if imgui.Selectable(label, checkbox.v, imgui.SelectableFlags.None, imgui.ImVec2(150, 20)) then
checkbox.v = not checkbox.v
updateText(checkbox, textKey)
end
if tooltip then
if imgui.IsItemHovered() then
imgui.SetTooltip(tooltip)
end
end
imgui.EndGroup()
end
local function CustomButton(label, onClick, tooltip)
if imgui.Button(label, imgui.ImVec2(150, 40)) then
onClick()
end
if tooltip and imgui.IsItemHovered() then
imgui.SetTooltip(tooltip)
end
end
local function CustomSlider(label, slider, min, max, tooltip)
imgui.Text(label)
imgui.SameLine(160)
if imgui.SliderInt('', slider, min, max, '%d') then
printStringNow(string.format('%s: %d', label, slider.v), 1000)
end
if tooltip then
if imgui.IsItemHovered() then
imgui.SetTooltip(tooltip)
end
end
end
local function CustomInputText(label, buffer, validationMessage)
imgui.Text(label)
imgui.SameLine(160)
if imgui.InputText('', buffer, imgui.InputTextFlags.None, imgui.ImVec2(200, 0)) then
-- Валидация: Проверка, является ли введённое значение числом
local value = tonumber(buffer.v)
if not value then
printStringNow(validationMessage, 1000)
buffer.v = '0.0' -- Сброс на значение по умолчанию
end
end
end
-- Главная Функция Отрисовки GUI
function imgui.OnDrawFrame()
if not Config.window.v then return end
setCustomStyle()
imgui.SetNextWindowPos(imgui.ImVec2(300.0, 200.0), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(600, 700), imgui.Cond.FirstUseEver)
if imgui.Begin('OTP by Tectrex', Config.window, imgui.WindowFlags.NoResize) then
-- Заголовок
imgui.PushFont(imgui.GetIO().Fonts:AddFontDefault())
imgui.TextColored(0.2, 0.6, 1.0, 1.0, '⚙️ Управление OTP')
imgui.PopFont()
imgui.Separator()
imgui.Spacing()
-- Статус 'Игрок в машине'
imgui.BeginChild('Status', imgui.ImVec2(580, 50), true)
if isCharInAnyCar(PLAYER_PED) then
imgui.TextColored(0.2, 1.0, 0.2, 1.0, '🛻 Игрок в машине')
if Config.checkboxes.govnovoz.v then
local car = getCarCharIsUsing(PLAYER_PED)
local posX, posY, _ = getNumericPosition()
local carX, carY, _ = getCarCoordinates(car)
local heading = getHeadingFromVector2d(posX - carX, posY - carY)
setCarCoordinates(car, carX, carY, Config.sliders.visotaGovnovoz.v)
setCarForwardSpeed(car, 100)
setCarHeading(car, heading)
setCharCanBeKnockedOffBike(PLAYER_PED, true)
else
local car = getCarCharIsUsing(PLAYER_PED)
freezeCarPosition(car, false)
setCharCanBeKnockedOffBike(PLAYER_PED, false)
end
else
imgui.TextColored(1.0, 0.2, 0.2, 1.0, '🚫 Игрок не в машине')
end
imgui.EndChild()
imgui.Separator()
imgui.Spacing()
-- Сворачивающиеся Разделы для Лучшей Организации
if imgui.CollapsingHeader('⚡ Основные Функции') then
imgui.Columns(2, 'main_features', true)
-- Левая колонка: Чекбоксы
imgui.BeginGroup()
CustomCheckbox('Говновоз', Config.checkboxes.govnovoz, 'govnovoz', 'Включить/Выключить Govnovoz.')
imgui.Spacing()
CustomCheckbox('Coord-Master', Config.checkboxes.coordMaster, 'coordMaster', 'Глобальное управление координатами.')
imgui.Spacing()
CustomCheckbox('Blip Finder', Config.checkboxes.blipFinder, 'blipFinder', 'Автоматический поиск и обновление координат блипов.')
imgui.Spacing()
CustomCheckbox('Marker Finder', Config.checkboxes.markerFinder, 'markerFinder', 'Автоматический поиск и обновление координат маркеров.')
imgui.EndGroup()
-- Правая колонка: Статусы
imgui.NextColumn()
imgui.BeginGroup()
for key, text in pairs(Config.texts) do
local color = text:find('Включено') and imgui.ImVec4(0.2, 1.0, 0.2, 1.0) or imgui.ImVec4(1.0, 0.2, 0.2, 1.0)
imgui.TextColored(color.x, color.y, color.z, color.w, text)
end
imgui.EndGroup()
imgui.Columns(1)
end
if imgui.CollapsingHeader('🔄 Автоматическое Обновление Позиции') then
imgui.Columns(2, 'auto_update', true)
-- Левая колонка: Автоматические Обновления
imgui.BeginGroup()
CustomCheckbox('Поиск Блипов', Config.checkboxes.blipFinder, 'blipFinder', 'Автоматически обновлять координаты блипов.')
imgui.Spacing()
CustomCheckbox('Поиск Маркеров', Config.checkboxes.markerFinder, 'markerFinder', 'Автоматически обновлять координаты маркеров.')
imgui.EndGroup()
-- Правая колонка: Информация
imgui.NextColumn()
imgui.BeginGroup()
if Config.checkboxes.blipFinder.v then
local success, x, y, z = getBlipCoordinates()
if success then
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(x), tostring(y), tostring(z)
else
imgui.TextColored(1.0, 0.3, 0.3, 1.0, '⚠️ Блип не найден.')
end
end
if Config.checkboxes.markerFinder.v then
local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
local found, markerX, markerY, markerZ = searchMarkers(posX, posY, posZ, Config.sliders.markerDistance.v, false)
if found then
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(markerX), tostring(markerY), tostring(markerZ)
else
imgui.TextColored(1.0, 0.3, 0.3, 1.0, '⚠️ Маркер не найден, пробуем найти гонки...')
local foundRace, raceX, raceY, raceZ = searchMarkers(posX, posY, posZ, Config.sliders.markerDistance.v, true)
if foundRace then
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(raceX), tostring(raceY), tostring(raceZ)
else
imgui.TextColored(1.0, 0.3, 0.3, 1.0, '⚠️ Гонки не найдены.')
end
end
end
imgui.EndGroup()
imgui.Columns(1)
end
imgui.Separator()
imgui.Spacing()
-- Ввод Позиции
if imgui.CollapsingHeader('📍 Ввод Координат') then
imgui.Columns(2, 'position_inputs', true)
-- Левая колонка: Ввод
imgui.BeginGroup()
CustomInputText('Координата X', Config.position.x, 'Некорректное значение для X')
imgui.Spacing()
CustomInputText('Координата Y', Config.position.y, 'Некорректное значение для Y')
imgui.Spacing()
CustomInputText('Координата Z', Config.position.z, 'Некорректное значение для Z')
imgui.EndGroup()
-- Правая колонка: Кнопки
imgui.NextColumn()
imgui.BeginGroup()
CustomButton('Получить координаты игрока', function()
local x, y, z = getCharCoordinates(PLAYER_PED)
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(x), tostring(y), tostring(z)
end, 'Получить текущие координаты игрока.')
imgui.Spacing()
CustomButton('Получить координаты маркера', function()
local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
local found, markerX, markerY, markerZ = searchMarkers(posX, posY, posZ, Config.sliders.markerDistance.v, false)
if found then
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(markerX), tostring(markerY), tostring(markerZ)
else
imgui.TextColored(1.0, 0.3, 0.3, 1.0, '⚠️ Маркер не найден, пробуем найти гонки...')
local foundRace, raceX, raceY, raceZ = searchMarkers(posX, posY, posZ, Config.sliders.markerDistance.v, true)
if foundRace then
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(raceX), tostring(raceY), tostring(raceZ)
end
end
end, 'Получить координаты ближайшего маркера.')
imgui.Spacing()
CustomButton('Получить координаты блипа', function()
local success, x, y, z = getBlipCoordinates()
if success then
Config.position.x.v, Config.position.y.v, Config.position.z.v = tostring(x), tostring(y), tostring(z)
else
imgui.TextColored(1.0, 0.3, 0.3, 1.0, '⚠️ Блип не найден.')
end
end, 'Получить координаты целевого блипа.')
imgui.EndGroup()
imgui.Columns(1)
end
imgui.Separator()
imgui.Spacing()
-- Слайдеры Настроек
if imgui.CollapsingHeader('⚙️ Настройки') then
imgui.Columns(2, 'settings', true)
-- Левая колонка: Слайдеры
imgui.BeginGroup()
CustomSlider('Высота Govnovoz', Config.sliders.visotaGovnovoz, 1, 500, 'Установить высоту Govnovoz.')
imgui.Spacing()
CustomSlider('Количество шагов', Config.sliders.stepDistance, 1, 500, 'Количество шагов при телепортации.')
imgui.Spacing()
CustomSlider('Задержка шага (мс)', Config.sliders.stepDelay, 0, 1000, 'Задержка между шагами телепортации в миллисекундах.')
imgui.Spacing()
CustomSlider('Расстояние поиска маркера', Config.sliders.markerDistance, 1, 10000, 'Радиус поиска маркера в единицах.')
imgui.EndGroup()
-- Правая колонка: Описание
imgui.NextColumn()
imgui.BeginGroup()
imgui.TextColored(0.6, 0.6, 0.6, 1.0, 'Настройте параметры телепортации и поиска маркеров.')
imgui.EndGroup()
imgui.Columns(1)
end
imgui.Separator()
imgui.Spacing()
-- Кнопка Телепортации
if imgui.CollapsingHeader('🚀 Действия') then
imgui.BeginGroup()
CustomButton('Телепортация', function()
local x, y, z = getNumericPosition()
if x and y and z then
if Config.checkboxes.coordMaster.v then
teleportPlayer(PLAYER_PED, x, y, z, Config.sliders.stepDistance.v, Config.sliders.stepDelay.v)
else
setPlayerCoordinates(x, y, z)
end
else
printDebug()
end
end, 'Выполнить телепортацию на указанные координаты.')
imgui.EndGroup()
end
end
imgui.End()
resetStyle()
end
-- Главная Функция
function main()
while not isSampAvailable() do
wait(200)
end
imgui.Process = false
Config.window.v = false
-- Регистрация Команд Чата
sampRegisterChatCommand('otp', toggleInterface)
sampRegisterChatCommand('otpr', function()
local x, y, z = getNumericPosition()
if x and y and z then
if Config.checkboxes.coordMaster.v then
teleportPlayer(PLAYER_PED, x, y, z, Config.sliders.stepDistance.v, Config.sliders.stepDelay.v)
else
setPlayerCoordinates(x, y, z)
end
else
printDebug()
end
end)
-- Основной Цикл
while true do
wait(0)
imgui.Process = Config.window.v
end
end