Вопрос, почему когда я вкл. клик варп начинает моргать WlHack.

FixZer

Активный
Автор темы
126
36
Версия MoonLoader
.026-beta

Всем добрый вечер. Я хочу задать вопрос и попросить помощи, почему моргает из - за Клик Варпа даже wlhack . Допусти я​

активировал wlhack_car.​

1627565370517.png

Он работает нормально, но после того как я активирую ClickWarp, то начинает моргать:

1627565512597.png

Прошу помощи, чтобы помочь исправить этот баг или не доработку.​

Буду очень благодарен.(За ранние спасибо)​

В низу оставляю скрипт на свой начальный биндер.(Не судите строго, я новичок в lua скрипте)​

Начальный биндер:
script_name('Binder for SAMP by FixZer v 4') -- название биндера
script_author('FixZer and Matteo') -- автор скрипта
script_description('Command') -- описание биндера

require "lib.moonloader" -- подключение библиотеки
require"lib.sampfuncs" -- подключение библиотеки
local Matrix3X3 = require "matrix3x3"
local Vector3D = require "vector3d"


--- Config
keyToggle = VK_MBUTTON
keyApply = VK_LBUTTON

local keys = require "vkeys"
local sampev = require "lib.samp.events"
local imgui = require "imgui"
local inicfg = require "inicfg"
local encoding = require "encoding"
encoding.default = 'CP1251'
u8 = encoding.UTF8

local rkeys = require "rkeys"
imgui.HotKey = require("imgui_addons").HotKey
imgui.ToggleButton = require("imgui_addons").ToggleButton
imgui.Spinner = require("imgui_addons").Spinner
imgui.BufferingBar = require("imgui_addons").BufferingBar

--  ##//\\//\\//\\//\\//\\//\\//##
-- ###//         WH CAR       //###
--  ##//\\//\\//\\//\\//\\//\\//##

local wh_car = imgui.ImBool(false)
local font = renderCreateFont('Arial',20,1)

local toggle_status = imgui.ImBool(false)
local toggle_status_2 = imgui.ImBool(false)
local ClickWarp = imgui.ImBool(false)

local themes = import "FMB Helper/imgui_themes"
local directIni = "moonloader\\FMB Helper\\settings.ini"

local tag = '[{E60C0C}FMB Helper{FFFFFF}]: ' -- локальная переменная
local label = 1
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"

local style = imgui.ImBool(false)
local settings = imgui.ImBool(false)
local binder = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(256)
local binderbuffer = imgui.ImBuffer(4096)

local checked_radio = imgui.ImInt(1)

--  ##//\\//\\//\\//\\//\\//\\//##
-- ###//       Сохранение     //###
--  ##//\\//\\//\\//\\//\\//\\//##

local mainIni = inicfg.load(nil, directIni)
-- local stateIni = inicfg.save(mainIni, directIni)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    initializeRender()
    
    sampRegisterChatCommand("rec", reconnect)
    sampRegisterChatCommand("l", cmd_l)
    sampRegisterChatCommand("k", cmd_k)
    sampRegisterChatCommand("optimal", cmd_optimal)
    sampRegisterChatCommand("cool", cmd_cool)
    sampRegisterChatCommand("un", cmd_uninvite)
    sampRegisterChatCommand("fmb", cmd_imgui)
    
    _, tid = sampGetPlayerIdByCharHandle(PLAYER_RED)
        
    imgui.Process = false

    imgui.SwitchContext()
    themes.SwitchColorTheme() -- Отвечает за цвет окна

    if label == 1 then
        -- условие 1
        sampAddChatMessage(tag .. "Binder for SAMP by FixZer and Matteo v 4", 0xFFFFFF)
        sampAddChatMessage(tag .. "FMB Helper запущен и готов к работе!", 0xFFFFFF)
        sampAddChatMessage(tag .. "Скачав наш помощник, вы никогда не пожалеете об этом", 0xFFFFFF)
    else
        -- условие 2
        sampAddChatMessage(tag .. "There are problems with the FMB Helper binder", 0xE60C0C)
    end
        
    -- Блок выполняется один раз после старта сампа
    
    while true do
        wait(0)

        --  ##//\\//\\//\\//\\//\\//\\//##
        -- ###//        WH CAR        //###
        --  ##//\\//\\//\\//\\//\\//\\//##

        if wh_car.v then
            for _, p_handle in pairs(getAllChars()) do
                if isCharOnScreen(p_handle) and p_handle ~= PLAYER_PED then
                    local res, id = sampGetPlayerIdByCharHandle(p_handle)
                    if res then
                        local x,y,z = getCharCoordinates(p_handle)
                        local x1,y2 = convert3DCoordsToScreen(x,y,z)
                        renderFontDrawText(font,string.format('ID %d',id),x1,y2,-1)
                    end
                end
            end
            for _, c_handle in pairs(getAllVehicles()) do
                if isCarOnScreen(c_handle) then
                    local res, id = sampGetVehicleIdByCarHandle(c_handle)
                    if res then
                        local x,y,z = getCarCoordinates(c_handle)
                        local x1,y2 = convert3DCoordsToScreen(x,y,z)
                        renderFontDrawText(font,string.format('{FFFFFF}CAR ID %d',id),x1,y2,-1)
                    end
                end
            end
        end

        --  ##//\\//\\//\\//\\//\\//\\//##
        -- ###//       Reconnect      //###
        --  ##//\\//\\//\\//\\//\\//\\//##

        if res and time ~= nil then
            sampDisconnectWithReason(quit)
            wait(time*1000)
            sampSetGamestate(1)
            res= false
            else if res and time == nil then
                sampDisconnectWithReason(quit)
                wait(15500)
                sampSetGamestate(1)
                res= false
            end
        end

        --  ##//\\//\\//\\//\\//\\//\\//##
        -- ###//       ClickWarp      //###
        --  ##//\\//\\//\\//\\//\\//\\//##

        if ClickWarp.v then
            while isPauseMenuActive() do
                if cursorEnabled then
                  showCursor(false)
                end
                wait(100)
              end

            if isKeyDown(keyToggle) then
                cursorEnabled = not cursorEnabled
                showCursor(cursorEnabled)
                while isKeyDown(keyToggle) do wait(80) end
              end
                    
              if cursorEnabled then
                local mode = sampGetCursorMode()
                if mode == 0 then
                  showCursor(true)
                end
                local sx, sy = getCursorPos()
                local sw, sh = getScreenResolution()
                -- is cursor in game window bounds?
                if sx >= 0 and sy >= 0 and sx < sw and sy < sh then
                  local posX, posY, posZ = convertScreenCoordsToWorld3D(sx, sy, 700.0)
                  local camX, camY, camZ = getActiveCameraCoordinates()
                  -- search for the collision point
                  local result, colpoint = processLineOfSight(camX, camY, camZ, posX, posY, posZ, true, true, false, true, false, false, false)
                  if result and colpoint.entity ~= 0 then
                    local normal = colpoint.normal
                    local pos = Vector3D(colpoint.pos[1], colpoint.pos[2], colpoint.pos[3]) - (Vector3D(normal[1], normal[2], normal[3]) * 0.1)
                    local zOffset = 300
                    if normal[3] >= 0.5 then zOffset = 1 end
                    -- search for the ground position vertically down
                    local result, colpoint2 = processLineOfSight(pos.x, pos.y, pos.z + zOffset, pos.x, pos.y, pos.z - 0.3,
                      true, true, false, true, false, false, false)
                    if result then
                      pos = Vector3D(colpoint2.pos[1], colpoint2.pos[2], colpoint2.pos[3] + 1)
          
                      local curX, curY, curZ  = getCharCoordinates(playerPed)
                      local dist              = getDistanceBetweenCoords3d(curX, curY, curZ, pos.x, pos.y, pos.z)
                      local hoffs             = renderGetFontDrawHeight(font)
          
                      sy = sy - 2
                      sx = sx - 2
                      renderFontDrawText(font, string.format("%0.2fm", dist), sx, sy - hoffs, 0xEEEEEEEE)
          
                      local tpIntoCar = nil
                      if colpoint.entityType == 2 then
                        local car = getVehiclePointerHandle(colpoint.entity)
                        if doesVehicleExist(car) and (not isCharInAnyCar(playerPed) or storeCarCharIsInNoSave(playerPed) ~= car) then
                          displayVehicleName(sx, sy - hoffs * 2, getNameOfVehicleModel(getCarModel(car)))
                          local color = 0xAAFFFFFF
                          if isKeyDown(VK_RBUTTON) then
                            tpIntoCar = car
                            color = 0xFFFFFFFF
                          end
                          renderFontDrawText(font2, "Hold right mouse button to teleport into the car", sx, sy - hoffs * 3, color)
                        end
                      end
          
                      createPointMarker(pos.x, pos.y, pos.z)
          
                      -- teleport!
                      if isKeyDown(keyApply) then
                        if tpIntoCar then
                          if not jumpIntoCar(tpIntoCar) then
                            -- teleport to the car if there is no free seats
                            teleportPlayer(pos.x, pos.y, pos.z)
                          end
                        else
                          if isCharInAnyCar(playerPed) then
                            local norm = Vector3D(colpoint.normal[1], colpoint.normal[2], 0)
                            local norm2 = Vector3D(colpoint2.normal[1], colpoint2.normal[2], colpoint2.normal[3])
                            rotateCarAroundUpAxis(storeCarCharIsInNoSave(playerPed), norm2)
                            pos = pos - norm * 1.8
                            pos.z = pos.z - 0.8
                          end
                          teleportPlayer(pos.x, pos.y, pos.z)
                        end
                        removePointMarker()
          
                        while isKeyDown(keyApply) do wait(0) end
                        showCursor(false)
                      end
                    end
                  end
                end
              end
              wait(0)
              removePointMarker()
        end

        --  ##//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//##
        -- ###//       Биндер при нажатии кнопок      //###
        --  ##//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//##

        if isKeyJustPressed(VK_F3) then
            sampSendChat("/d [ЛВПД] - [Всем]: Занимаю государственную волну.")
            wait(2000)
            sampSendChat("/gov Дорогие жители штата Детройт минуточку внимания!")
            wait(2000)
            sampSendChat("/gov Мы спешим сообщить, что сейчас пройдёт собеседование в ЛВПД.")
            wait(2000)
            sampSendChat("/gov Собеседование пройдёт в Холле Полиции Лас-Вентурас!")
            wait(2000)
            sampSendChat("/gov При себе иметь паспорт и лицензии.")
            wait(2000)
            sampSendChat("/gov Ждём всех в Холле Полиции Лас-Вентурас.")
            wait(2000)
            sampSendChat("/d [ЛВПД] - [Всем]: Освобождаю государственную волну.")
        end
        
        if isKeyDown(VK_MENU) and isKeyJustPressed(VK_9) then
            sampSendChat("Поздравляю вы нам подходите")
            wait(1500)
            sampSendChat("/do В кармане пиджака лежат ключи от раздевалке.")
            wait(1500)
            sampSendChat("/me резким движением достал из кармана ключи от раздевалки,")
            wait(1500)
            sampSendChat("/me передал ключи от шкафчика в раздевалке человеку на против")
            wait(1500)
            sampAddChatMessage("Напишите команду: /invite (id игрока)", main_color)
            wait(5000)
            sampSendChat("Удачного рабочего дня!")
        end
        -- Блок выполняется бесконечно (пока самп активен)
        
    end
end

--  ##//\\//\\//\\//\\//\\//\\//##
-- ###//    Для сохранения    //###
--  ##//\\//\\//\\//\\//\\//\\//##

--  ##//\\//\\//\\//\\//\\//\\//##
-- ###//       Reconnect      //###
--  ##//\\//\\//\\//\\//\\//\\//##

function reconnect(param)
    time = tonumber(param)
    res = true
end

--  ##//\\//\\//\\//\\//\\//\\//##
-- ###//       ClickWarp      //###
--  ##//\\//\\//\\//\\//\\//\\//##

function initializeRender()
  font = renderCreateFont("Tahoma", 10, FCR_BOLD + FCR_BORDER)
  font2 = renderCreateFont("Arial", 8, FCR_ITALICS + FCR_BORDER)
end


--- Functions
function rotateCarAroundUpAxis(car, vec)
  local mat = Matrix3X3(getVehicleRotationMatrix(car))
  local rotAxis = Vector3D(mat.up:get())
  vec:normalize()
  rotAxis:normalize()
  local theta = math.acos(rotAxis:dotProduct(vec))
  if theta ~= 0 then
    rotAxis:crossProduct(vec)
    rotAxis:normalize()
    rotAxis:zeroNearZero()
    mat = mat:rotate(rotAxis, -theta)
  end
  setVehicleRotationMatrix(car, mat:get())
end

function readFloatArray(ptr, idx)
  return representIntAsFloat(readMemory(ptr + idx * 4, 4, false))
end

function writeFloatArray(ptr, idx, value)
  writeMemory(ptr + idx * 4, 4, representFloatAsInt(value), false)
end

function getVehicleRotationMatrix(car)
  local entityPtr = getCarPointer(car)
  if entityPtr ~= 0 then
    local mat = readMemory(entityPtr + 0x14, 4, false)
    if mat ~= 0 then
      local rx, ry, rz, fx, fy, fz, ux, uy, uz
      rx = readFloatArray(mat, 0)
      ry = readFloatArray(mat, 1)
      rz = readFloatArray(mat, 2)

      fx = readFloatArray(mat, 4)
      fy = readFloatArray(mat, 5)
      fz = readFloatArray(mat, 6)

      ux = readFloatArray(mat, 8)
      uy = readFloatArray(mat, 9)
      uz = readFloatArray(mat, 10)
      return rx, ry, rz, fx, fy, fz, ux, uy, uz
    end
  end
end

function setVehicleRotationMatrix(car, rx, ry, rz, fx, fy, fz, ux, uy, uz)
  local entityPtr = getCarPointer(car)
  if entityPtr ~= 0 then
    local mat = readMemory(entityPtr + 0x14, 4, false)
    if mat ~= 0 then
      writeFloatArray(mat, 0, rx)
      writeFloatArray(mat, 1, ry)
      writeFloatArray(mat, 2, rz)

      writeFloatArray(mat, 4, fx)
      writeFloatArray(mat, 5, fy)
      writeFloatArray(mat, 6, fz)

      writeFloatArray(mat, 8, ux)
      writeFloatArray(mat, 9, uy)
      writeFloatArray(mat, 10, uz)
    end
  end
end

function displayVehicleName(x, y, gxt)
  x, y = convertWindowScreenCoordsToGameScreenCoords(x, y)
  useRenderCommands(true)
  setTextWrapx(640.0)
  setTextProportional(true)
  setTextJustify(false)
  setTextScale(0.33, 0.8)
  setTextDropshadow(0, 0, 0, 0, 0)
  setTextColour(255, 255, 255, 230)
  setTextEdge(1, 0, 0, 0, 100)
  setTextFont(1)
  displayText(x, y, gxt)
end

function createPointMarker(x, y, z)
  pointMarker = createUser3dMarker(x, y, z + 0.3, 4)
end

function removePointMarker()
  if pointMarker then
    removeUser3dMarker(pointMarker)
    pointMarker = nil
  end
end

function getCarFreeSeat(car)
  if doesCharExist(getDriverOfCar(car)) then
    local maxPassengers = getMaximumNumberOfPassengers(car)
    for i = 0, maxPassengers do
      if isCarPassengerSeatFree(car, i) then
        return i + 1
      end
    end
    return nil -- no free seats
  else
    return 0 -- driver seat
  end
end

function jumpIntoCar(car)
  local seat = getCarFreeSeat(car)
  if not seat then return false end                         -- no free seats
  if seat == 0 then warpCharIntoCar(playerPed, car)         -- driver seat
  else warpCharIntoCarAsPassenger(playerPed, car, seat - 1) -- passenger seat
  end
  restoreCameraJumpcut()
  return true
end

function teleportPlayer(x, y, z)
  if isCharInAnyCar(playerPed) then
    setCharCoordinates(playerPed, x, y, z)
  end
  setCharCoordinatesDontResetAnim(playerPed, x, y, z)
end

function setCharCoordinatesDontResetAnim(char, x, y, z)
  if doesCharExist(char) then
    local ptr = getCharPointer(char)
    setEntityCoordinates(ptr, x, y, z)
  end
end

function setEntityCoordinates(entityPtr, x, y, z)
  if entityPtr ~= 0 then
    local matrixPtr = readMemory(entityPtr + 0x14, 4, false)
    if matrixPtr ~= 0 then
      local posPtr = matrixPtr + 0x30
      writeMemory(posPtr + 0, 4, representFloatAsInt(x), false) -- X
      writeMemory(posPtr + 4, 4, representFloatAsInt(y), false) -- Y
      writeMemory(posPtr + 8, 4, representFloatAsInt(z), false) -- Z
    end
  end
end

function showCursor(toggle)
  if toggle then
    sampSetCursorMode(CMODE_LOCKCAM)
  else
    sampToggleCursor(false)
  end
  cursorEnabled = toggle
end

--  ##//\\//\\//\\//\\//\\//##
-- ###//      Команды     //###
--  ##//\\//\\//\\//\\//\\//##

function cmd_imgui(arg)
    main_window_state.v = not main_window_state.v
    imgui.Process = main_window_state.v

    themes.SwitchColorTheme(tonumber(arg))
end

function cmd_l(arg)
    sampSendChat("/lmenu")
end

function cmd_k(arg)
    if #arg == 0 then
        sampAddChatMessage("Введитие id игрока", main_color)
    else
        sampSendChat("/kick " .. arg .. " ДМ на МП")
    end
end

function cmd_uninvite(arg)
    if #arg == 0 then
        sampAddChatMessage("Чтобы уволить игрока введите id (игрок будет уволен по прчине: Профф непригоден.)", main_color)
    else
        sampSendChat("/uninvite " .. arg .. " Профф непригоден")
    end
end

function cmd_optimal(arg)
    if #arg == 0 then
        sampAddChatMessage("Привет, вы ввели команду, но не ввели аргумент :(", main_color)
    else
        sampAddChatMessage("Привет! Вы ввели команду и ввели аргумент: {FFFFFF}" .. arg, main_color)

    end
end

function cmd_cool(arg)
    var1, var2 = string.match(arg, "(.+) (.+)")
    if var1 == null or var1 == "" then
        sampAddChatMessage("Неплохо, у вас уже 2 аргумента, но вы их их не ввели :(", main_color)
    else
        sampAddChatMessage("Круто, вы ввели команду и 2 аргумента. 1ый: " .. white_color .. var1 .. ", " .. main_color_text .. "2ой: " .. white_color .. var2, main_color)
    end
end

--  ##//\\//\\//\\//\\//\\//\\//##
-- ###//         HotKey       //###
--  ##//\\//\\//\\//\\//\\//\\//##

--  ##//\\//\\//\\//\\//\\//##
-- ###//       Imgui      //###
--  ##//\\//\\//\\//\\//\\//##

function imgui.OnDrawFrame()

    if not main_window_state.v then
        imgui.Process = false
    end
    
    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(900, 600), imgui.Cond.FirstUseEver)
        
        imgui.Begin("FMB  Helper", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.InputText(u8"Вводить текст сюда", text_buffer)
        imgui.Text(text_buffer.v)
        imgui.BeginChild("ChildWindow10", imgui.ImVec2(103, 523), false)
        --  ##//\\//\\//\\//\\//\\//\\//##
        -- ###//    Кнопки в imgui    //###
        --  ##//\\//\\//\\//\\//\\//\\//##       
            if imgui.Button(u8"Стиль Хелпера", imgui.ImVec2(95,20)) then
                style.v = not style.v
                settings.v = false
                binder.v = false
            end

            if imgui.Button(u8"    Основное", imgui.ImVec2(95,20), false) then
                settings.v = not settings.v
                style.v = false
                binder.v = false
            end

            if imgui.Button(u8"     Биндер", imgui.ImVec2(95,20)) then
                binder.v = not binder.v
                settings.v = false
                style.v = false
            end
        imgui.EndChild()
        --  ##//\\//\\//\\//\\//\\//\\//\\//\\//\\//##
        -- ###//    Функции кнопок при нажатии    //###
        --  ##//\\//\\//\\//\\//\\//\\//\\//\\//\\//##
        if style.v then
            imgui.SetCursorPos(imgui.ImVec2(105, 65))
            imgui.BeginChild("ChildWindow", imgui.ImVec2(775, 525), true)
            for i, value in ipairs(themes.colorThemes) do
                if imgui.RadioButton(value, checked_radio, i) then
                    themes.SwitchColorTheme(i)
                end
            end
            imgui.EndChild()
        end
        
        if settings.v then
            imgui.SetCursorPos(imgui.ImVec2(105, 65))
            imgui.BeginChild("ChildWindow1", imgui.ImVec2(775, 525), true)
                if imgui.ToggleButton('ClickWarp', toggle_status) then
                    mainIni.config.ClickWarp = toggle_status
                    if inicfg.save(mainIni, directIni) then
                        ClickWarp.v = not ClickWarp.v
                    end
                end

                if imgui.ToggleButton('Wlhack_car', toggle_status_2)then
                    wh_car.v = not wh_car.v
                end
            imgui.EndChild()
        end

        if binder.v then
            imgui.SetCursorPos(imgui.ImVec2(105, 65))
            imgui.BeginChild("ChildWindow1", imgui.ImVec2(775, 525), true)
            imgui.SetCursorPos(imgui.ImVec2(5, 220))
            imgui.InputTextMultiline(u8"", binderbuffer, imgui.ImVec2(765,300))
            imgui.EndChild()
        end

         --  ##//\\//\\//\\//\\//\\//\\//\\//\\//##
        -- ###//    Команды на выполнение     //###
        --  ##//\\//\\//\\//\\//\\//\\//\\//\\//##

        imgui.End()
    end
end

--  ##//\\//\\//\\//\\//\\//##
-- ###//      Модули      //###
--  ##//\\//\\//\\//\\//\\//##


function sampev.onSendChat(text) -- OUTCOMING_PACKETS // Отправка пакета при отправке текста в чат
    
end

function sampev.onSendCommand(command) -- OUTCOMING_PACKETS // Отправка пакета при отправке команды в чат
    
end

function sampev.onSendPickedUoPickup(pickupId) -- OUTCOMING_PACKETS // Отправка пакета при взаимодействии с пикапом
    
end

function sampev.onSendExitVehicle(vehicleId) -- OUTCOMING_PACKETS // Отправка пакета при взаимодействии автомобилем (При высадке с авто)
    
end

function sampev.onSendEnterVehicle(vehicleId, passenger) -- OUTCOMING_PACKETS // Отправка пакета при взаимодействии автомобилем (При посадке с авто)
    
end

function sampev.onServerMessage(color, text) -- OUTCOMING_PACKETS // Получение пакет при появлении сообщения в чате от сервера
    if string.find(text, 'Внимание!', 1, true) then
        return false
    end

    if string.find(text, '[Жалоба]', 1, true) then
        sampAddChatMessage(tag .. "Поступила новая жалоба от игрока, скорее ответь!", -1)
        sampAddChatMessage(tag .. "Чтобы ответить на жалобу напишите команду /ot !!", -1)
    end
end

function sampev.onShowDialog(dialog, style, title, button1, button2, text) -- OUTCOMING_PACKETS // Получение пакета при открытии самп диалогов
    
end

function sampev.onSetInterior(interior) -- OUTCOMING_PACKETS // Получение пакета при изменении интерьера
    
end

function sampev.onDisplayGameText(style, time, text) -- OUTCOMING_PACKETS // Получение пакета при появлении GameText'a

end

function sampev.onApplyPlayerAnimation(playerId, animLib, animName, loop, lockY, freeze, time) -- OUTCOMING_PACKETS // Получение пакета при изменении анимации педа

end
 

FixZer

Активный
Автор темы
126
36
Потому что при нажатии на колесико мыши гта тебя шлет на 4 стороны и говорит что с этого момента ты смотришь жопой, а из-за этого почему то все такие визуальные функции идут к чертям
А как это исправить ?
 

woodware

Потрачен
Проверенный
4,474
1,237
А как это исправить ?
зайди в настройки управления настройки управления персонажа и там обернутся либо вовсе убираешь либо колесико меняй на другуй кнопку
 

FixZer

Активный
Автор темы
126
36
ClickWarp:
        if ClickWarp.v then
            while isPauseMenuActive() do
                if cursorEnabled then
                  showCursor(false)
                end
                wait(100)
              end

            if isKeyDown(keyToggle) then
                cursorEnabled = not cursorEnabled
                showCursor(cursorEnabled)
                while isKeyDown(keyToggle) do wait(80) end
              end
                   
              if cursorEnabled then
                local mode = sampGetCursorMode()
                if mode == 0 then
                  showCursor(true)
                end
                local sx, sy = getCursorPos()
                local sw, sh = getScreenResolution()
                -- is cursor in game window bounds?
                if sx >= 0 and sy >= 0 and sx < sw and sy < sh then
                  local posX, posY, posZ = convertScreenCoordsToWorld3D(sx, sy, 700.0)
                  local camX, camY, camZ = getActiveCameraCoordinates()
                  -- search for the collision point
                  local result, colpoint = processLineOfSight(camX, camY, camZ, posX, posY, posZ, true, true, false, true, false, false, false)
                  if result and colpoint.entity ~= 0 then
                    local normal = colpoint.normal
                    local pos = Vector3D(colpoint.pos[1], colpoint.pos[2], colpoint.pos[3]) - (Vector3D(normal[1], normal[2], normal[3]) * 0.1)
                    local zOffset = 300
                    if normal[3] >= 0.5 then zOffset = 1 end
                    -- search for the ground position vertically down
                    local result, colpoint2 = processLineOfSight(pos.x, pos.y, pos.z + zOffset, pos.x, pos.y, pos.z - 0.3,
                      true, true, false, true, false, false, false)
                    if result then
                      pos = Vector3D(colpoint2.pos[1], colpoint2.pos[2], colpoint2.pos[3] + 1)
         
                      local curX, curY, curZ  = getCharCoordinates(playerPed)
                      local dist              = getDistanceBetweenCoords3d(curX, curY, curZ, pos.x, pos.y, pos.z)
                      local hoffs             = renderGetFontDrawHeight(font)
         
                      sy = sy - 2
                      sx = sx - 2
                      renderFontDrawText(font, string.format("%0.2fm", dist), sx, sy - hoffs, 0xEEEEEEEE)
         
                      local tpIntoCar = nil
                      if colpoint.entityType == 2 then
                        local car = getVehiclePointerHandle(colpoint.entity)
                        if doesVehicleExist(car) and (not isCharInAnyCar(playerPed) or storeCarCharIsInNoSave(playerPed) ~= car) then
                          displayVehicleName(sx, sy - hoffs * 2, getNameOfVehicleModel(getCarModel(car)))
                          local color = 0xAAFFFFFF
                          if isKeyDown(VK_RBUTTON) then
                            tpIntoCar = car
                            color = 0xFFFFFFFF
                          end
                          renderFontDrawText(font2, "Hold right mouse button to teleport into the car", sx, sy - hoffs * 3, color)
                        end
                      end
         
                      createPointMarker(pos.x, pos.y, pos.z)
         
                      -- teleport!
                      if isKeyDown(keyApply) then
                        if tpIntoCar then
                          if not jumpIntoCar(tpIntoCar) then
                            -- teleport to the car if there is no free seats
                            teleportPlayer(pos.x, pos.y, pos.z)
                          end
                        else
                          if isCharInAnyCar(playerPed) then
                            local norm = Vector3D(colpoint.normal[1], colpoint.normal[2], 0)
                            local norm2 = Vector3D(colpoint2.normal[1], colpoint2.normal[2], colpoint2.normal[3])
                            rotateCarAroundUpAxis(storeCarCharIsInNoSave(playerPed), norm2)
                            pos = pos - norm * 1.8
                            pos.z = pos.z - 0.8
                          end
                          teleportPlayer(pos.x, pos.y, pos.z)
                        end
                        removePointMarker()
         
                        while isKeyDown(keyApply) do wait(0) end
                        showCursor(false)
                      end
                    end
                  end
                end
              end
              removePointMarker()
        end
Я убрал Задержку wait(0) и теперь у меня не моргает, но пропал маркер
 

Smeruxa

Известный
1,294
680
ClickWarp:
        if ClickWarp.v then
            while isPauseMenuActive() do
                if cursorEnabled then
                  showCursor(false)
                end
                wait(100)
              end

            if isKeyDown(keyToggle) then
                cursorEnabled = not cursorEnabled
                showCursor(cursorEnabled)
                while isKeyDown(keyToggle) do wait(80) end
              end
                  
              if cursorEnabled then
                local mode = sampGetCursorMode()
                if mode == 0 then
                  showCursor(true)
                end
                local sx, sy = getCursorPos()
                local sw, sh = getScreenResolution()
                -- is cursor in game window bounds?
                if sx >= 0 and sy >= 0 and sx < sw and sy < sh then
                  local posX, posY, posZ = convertScreenCoordsToWorld3D(sx, sy, 700.0)
                  local camX, camY, camZ = getActiveCameraCoordinates()
                  -- search for the collision point
                  local result, colpoint = processLineOfSight(camX, camY, camZ, posX, posY, posZ, true, true, false, true, false, false, false)
                  if result and colpoint.entity ~= 0 then
                    local normal = colpoint.normal
                    local pos = Vector3D(colpoint.pos[1], colpoint.pos[2], colpoint.pos[3]) - (Vector3D(normal[1], normal[2], normal[3]) * 0.1)
                    local zOffset = 300
                    if normal[3] >= 0.5 then zOffset = 1 end
                    -- search for the ground position vertically down
                    local result, colpoint2 = processLineOfSight(pos.x, pos.y, pos.z + zOffset, pos.x, pos.y, pos.z - 0.3,
                      true, true, false, true, false, false, false)
                    if result then
                      pos = Vector3D(colpoint2.pos[1], colpoint2.pos[2], colpoint2.pos[3] + 1)
        
                      local curX, curY, curZ  = getCharCoordinates(playerPed)
                      local dist              = getDistanceBetweenCoords3d(curX, curY, curZ, pos.x, pos.y, pos.z)
                      local hoffs             = renderGetFontDrawHeight(font)
        
                      sy = sy - 2
                      sx = sx - 2
                      renderFontDrawText(font, string.format("%0.2fm", dist), sx, sy - hoffs, 0xEEEEEEEE)
        
                      local tpIntoCar = nil
                      if colpoint.entityType == 2 then
                        local car = getVehiclePointerHandle(colpoint.entity)
                        if doesVehicleExist(car) and (not isCharInAnyCar(playerPed) or storeCarCharIsInNoSave(playerPed) ~= car) then
                          displayVehicleName(sx, sy - hoffs * 2, getNameOfVehicleModel(getCarModel(car)))
                          local color = 0xAAFFFFFF
                          if isKeyDown(VK_RBUTTON) then
                            tpIntoCar = car
                            color = 0xFFFFFFFF
                          end
                          renderFontDrawText(font2, "Hold right mouse button to teleport into the car", sx, sy - hoffs * 3, color)
                        end
                      end
        
                      createPointMarker(pos.x, pos.y, pos.z)
        
                      -- teleport!
                      if isKeyDown(keyApply) then
                        if tpIntoCar then
                          if not jumpIntoCar(tpIntoCar) then
                            -- teleport to the car if there is no free seats
                            teleportPlayer(pos.x, pos.y, pos.z)
                          end
                        else
                          if isCharInAnyCar(playerPed) then
                            local norm = Vector3D(colpoint.normal[1], colpoint.normal[2], 0)
                            local norm2 = Vector3D(colpoint2.normal[1], colpoint2.normal[2], colpoint2.normal[3])
                            rotateCarAroundUpAxis(storeCarCharIsInNoSave(playerPed), norm2)
                            pos = pos - norm * 1.8
                            pos.z = pos.z - 0.8
                          end
                          teleportPlayer(pos.x, pos.y, pos.z)
                        end
                        removePointMarker()
        
                        while isKeyDown(keyApply) do wait(0) end
                        showCursor(false)
                      end
                    end
                  end
                end
              end
              removePointMarker()
        end
Я убрал Задержку wait(0) и теперь у меня не моргает, но пропал маркер
Лично я засунул в функцию, а там уже сделал беск цикл ещё один