трабл с airbrk

no3jour

Участник
Автор темы
55
0
Версия MoonLoader
.026-beta
включаю аирбрейк при управлении позиция не меняется
Lua:
function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end
  commandsReg();
  welcome();
  while true do
    wait(0)
    if wasKeyPressed(key.VK_M) then
      if tonumber(login) == 1 then
        imgui_1.v = not imgui_1.v
      else
        imgui_2.v = not imgui_2.v
      end
    end
    if isKeyJustPressed(key.VK_F9) then -- airbrake
      airBrkState = not airBrkState
      if airBrkState then
        local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
        airBrkCoords = {posX, posY, posZ, 0.0, 0.0, getCharHeading(PLAYER_PED)}
      end
    end
    if wasKeyPressed(key.VK_Z) then
      if tonumber(login) == 0 then
        sampAddChatMessage('{FFFFFF}Ошибка, вы не авторизовались, нажмите клавишу M(англ)')
      else
        imgui_3.v = not imgui_3.v
      end
    end
    imgui.Process = imgui_1.v or imgui_2.v or imgui_3.v
    renderBulletTracks();
    air();
  end
end
function air()
  if airBrkState then
    local time = os.clock() * 1000
    if isCharInAnyCar(playerPed) then heading = getCarHeading(storeCarCharIsInNoSave(playerPed))
    else heading = getCharHeading(playerPed) end
    local camCoordX, camCoordY, camCoordZ = getActiveCameraCoordinates()
    local targetCamX, targetCamY, targetCamZ = getActiveCameraPointAt()
    local angle = getHeadingFromVector2d(targetCamX - camCoordX, targetCamY - camCoordY)
    if isCharInAnyCar(playerPed) then difference = 0.79 else difference = 1.0 end
    setCharCoordinates(playerPed, airBrkCoords[1], airBrkCoords[2], airBrkCoords[3] - difference)
    if isKeyDown(VK_W) then
        airBrkCoords[1] = airBrkCoords[1] + gui['speed-airbrake'].v * math.sin(-math.rad(angle))
        airBrkCoords[2] = airBrkCoords[2] + gui['speed-airbrake'].v * math.cos(-math.rad(angle))
        if not isCharInAnyCar(playerPed) then setCharHeading(playerPed, angle)
        else setCarHeading(storeCarCharIsInNoSave(playerPed), angle) end
    elseif isKeyDown(VK_S) then
        airBrkCoords[1] = airBrkCoords[1] - gui['speed-airbrake'].v * math.sin(-math.rad(heading))
        airBrkCoords[2] = airBrkCoords[2] - gui['speed-airbrake'].v * math.cos(-math.rad(heading))
    end
    if isKeyDown(VK_A) then
        airBrkCoords[1] = airBrkCoords[1] - gui['speed-airbrake'].v * math.sin(-math.rad(heading - 90))
        airBrkCoords[2] = airBrkCoords[2] - gui['speed-airbrake'].v * math.cos(-math.rad(heading - 90))
    elseif isKeyDown(VK_D) then
        airBrkCoords[1] = airBrkCoords[1] - gui['speed-airbrake'].v * math.sin(-math.rad(heading + 90))
        airBrkCoords[2] = airBrkCoords[2] - gui['speed-airbrake'].v * math.cos(-math.rad(heading + 90))
    end
    if isKeyDown(VK_UP) then airBrkCoords[3] = airBrkCoords[3] + gui['speed-airbrake'].v / 2.0 end
    if isKeyDown(VK_DOWN) and airBrkCoords[3] > -95.0 then airBrkCoords[3] = airBrkCoords[3] - gui['speed-airbrake'].v / 2.0 end
    if not isSampfuncsConsoleActive() and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() then
        if isKeyDown(VK_OEM_PLUS) and time - tick.Keys.Plus > tick.Time.PlusMinus then
            if gui['speed-airbrake'].v < 19.9 then gui['speed-airbrake'].v = gui['speed-airbrake'].v + 0.5 end
            printStringNow(string.format('AirBrk speed changed to: %.1f.', gui['speed-airbrake'].v), 1000)
            tick.Keys.Plus = os.clock() * 1000
        elseif isKeyDown(VK_OEM_MINUS) and time - tick.Keys.Minus > tick.Time.PlusMinus then
            if gui['speed-airbrake'].v > 0.5 then gui['speed-airbrake'].v = gui['speed-airbrake'].v - 0.5 end
            printStringNow(string.format('AirBrk speed changed to: %.1f.', gui['speed-airbrake'].v), 1000)
            tick.Keys.Minus = os.clock() * 1000
        end
    end
  end
end
 
Последнее редактирование модератором: