Вопросы по Lua скриптингу

Общая тема для вопросов по разработке скриптов на языке программирования Lua, в частности под MoonLoader.
  • Задавая вопрос, убедитесь, что его нет в списке частых вопросов и что на него ещё не отвечали (воспользуйтесь поиском).
  • Поищите ответ в теме посвященной разработке Lua скриптов в MoonLoader
  • Отвечая, убедитесь, что ваш ответ корректен.
  • Старайтесь как можно точнее выразить мысль, а если проблема связана с кодом, то обязательно прикрепите его к сообщению, используя блок [code=lua]здесь мог бы быть ваш код[/code].
  • Если вопрос связан с MoonLoader-ом первым делом желательно поискать решение на wiki.

Частые вопросы

Как научиться писать скрипты? С чего начать?
Информация - Гайд - Всё о Lua скриптинге для MoonLoader(https://blast.hk/threads/22707/)
Как вывести текст на русском? Вместо русского текста у меня какие-то каракули.
Изменить кодировку файла скрипта на Windows-1251. В Atom: комбинация клавиш Ctrl+Shift+U, в Notepad++: меню Кодировки -> Кодировки -> Кириллица -> Windows-1251.
Как получить транспорт, в котором сидит игрок?
Lua:
local veh = storeCarCharIsInNoSave(PLAYER_PED)
Как получить свой id или id другого игрока?
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED) -- получить свой ид
local _, id = sampGetPlayerIdByCharHandle(ped) -- получить ид другого игрока. ped - это хендл персонажа
Как проверить, что строка содержит какой-то текст?
Lua:
if string.find(str, 'текст', 1, true) then
-- строка str содержит "текст"
end
Как эмулировать нажатие игровой клавиши?
Lua:
local game_keys = require 'game.keys' -- где-нибудь в начале скрипта вне функции main

setGameKeyState(game_keys.player.FIREWEAPON, -1) -- будет сэмулировано нажатие клавиши атаки
Все иды клавиш находятся в файле moonloader/lib/game/keys.lua.
Подробнее о функции setGameKeyState здесь: lua - setgamekeystate | BlastHack — DEV_WIKI(https://www.blast.hk/wiki/lua:setgamekeystate)
Как получить id другого игрока, в которого целюсь я?
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) -- получить хендл персонажа, в которого целится игрок
if valid and doesCharExist(ped) then -- если цель есть и персонаж существует
  local result, id = sampGetPlayerIdByCharHandle(ped) -- получить samp-ид игрока по хендлу персонажа
  if result then -- проверить, прошло ли получение ида успешно
    -- здесь любые действия с полученным идом игрока
  end
end
Как зарегистрировать команду чата SAMP?
Lua:
-- До бесконечного цикла/задержки
sampRegisterChatCommand("mycommand", function (param)
     -- param будет содержать весь текст введенный после команды, чтобы разделить его на аргументы используйте string.match()
    sampAddChatMessage("MyCMD", -1)
end)
Крашит игру при вызове sampSendChat. Как это исправить?
Это происходит из-за бага в SAMPFUNCS, когда производится попытка отправки пакета определенными функциями изнутри события исходящих RPC и пакетов. Исправления для этого бага нет, но есть способ не провоцировать его. Вызов sampSendChat изнутри обработчика исходящих RPC/пакетов нужно обернуть в скриптовый поток с нулевой задержкой:
Lua:
function onSendRpc(id)
  -- крашит:
  -- sampSendChat('Send RPC: ' .. id)

  -- норм:
  lua_thread.create(function()
    wait(0)
    sampSendChat('Send RPC: ' .. id)
  end)
end
 
Последнее редактирование:

Fyger

Потрачен
963
418
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Ку, чёт мои руки из жопы снова сломали скрипт, как только активирую vr.v я не могу выключить окно имгуи, на чит-код не реагирует, нажму на крестик будет краш. В чём дело? Как я понял это что то связанное с задержкой
Lua:
local imgui = require 'imgui'
local encoding = require 'encoding'
local inicfg = require 'inicfg'
local hook = require 'lib.samp.events'
local bNotf, notf = pcall(import, "imgui_notf.lua")
encoding.default = 'CP1251'
u8 = encoding.UTF8

local mainIni = inicfg.load({
config =
{
lic = false,
trade = false,
tlf = false,
arm = false,
msk = false,
smk = false,
time = false,
lock = false,
jlock = false,
fcar = false,
recar = false,
key = false,
vr = false,
aut = false,
abc = false,
waitb = false,
acd = false,
mbc = false,
at = false,
setwaiter = 0,
}
}, "ARZ HotKeys")

local lic = imgui.ImBool(mainIni.config.lic)
local trade = imgui.ImBool(mainIni.config.trade)
local tlf = imgui.ImBool(mainIni.config.tlf)
local arm = imgui.ImBool(mainIni.config.arm)
local msk = imgui.ImBool(mainIni.config.msk)
local smk = imgui.ImBool(mainIni.config.smk)
local time = imgui.ImBool(mainIni.config.time)
local lock = imgui.ImBool(mainIni.config.lock)
local jlock = imgui.ImBool(mainIni.config.jlock)
local fcar = imgui.ImBool(mainIni.config.fcar)
local recar = imgui.ImBool(mainIni.config.recar)
local key = imgui.ImBool(mainIni.config.key)
local vr = imgui.ImBool(mainIni.config.vr)
local aut = imgui.ImBool(mainIni.config.aut)
local abc = imgui.ImBool(mainIni.config.abc)
local waitb = imgui.ImBool(mainIni.config.waitb)
local acd = imgui.ImBool(mainIni.config.acd)
local at = imgui.ImBool(mainIni.config.at)
local setwaiter = imgui.ImInt(10000)
smsbc = imgui.ImBuffer("EZ car", 100)
chatsms = imgui.ImBuffer(u8'/vr ', 100)
local mbc = imgui.ImBool(mainIni.config.mbc)

local status = inicfg.load(mainIni, 'ARZ HotKeys.ini')
if not doesFileExist('moonloader/config/ARZ HotKets.ini') then inicfg.save(mainIni, 'ARZ HotKeys.ini') end

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
    if main_window_state.v then
      imgui.SetNextWindowSize(imgui.ImVec2(700, 520), imgui.Cond.FirstUseEver)
      if not window_pos then
            ScreenX, ScreenY = getScreenResolution()ScreenX, ScreenY = getScreenResolution()
            imgui.SetNextWindowPos(imgui.ImVec2(ScreenX / 2 , ScreenY / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
        end
      imgui.Begin('By Fyger | ARZ HotKeys | for Bavles gang empire', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoScrollbar)
      imgui.Text("Vk Author: @mq228_suqa1488")
      imgui.BeginChild("##g_sexbar", imgui.ImVec2(300, 120), true, imgui.WindowFlags.NoScrollbar)
      imgui.Checkbox(u8"Показ лицензий ближайшему игроку", lic)
      imgui.SameLine()
      imgui.TextQuestion(u8'При нажатии клавиш ALT + 1 вы покажите лицензии ближайшему игроку')
      imgui.Checkbox(u8"Торговля ближайшему игроку", trade)
      imgui.SameLine()
      imgui.TextQuestion(u8'При нажатии клавиш ALT + 2 вы предложите торговлю ближайшему игроку')
      imgui.Checkbox(u8"Телефон", tlf)
      imgui.SameLine()
      imgui.TextQuestion(u8"При нажатии на клавишу P у вас откроется телефон" )
      imgui.EndChild()
      imgui.BeginChild("##gay_bar", imgui.ImVec2(300, 120), true, imgui.WindowFlags.NoScrollbar)
      imgui.Checkbox(u8"Бронежилет", arm)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочетании клавиш ARM у вас появится бронежилет")
      imgui.Checkbox(u8"Маска", msk)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочетании клавиш MASK у вас появится маска")
      imgui.Checkbox(u8"Сигарета", smk)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочетании клавиш SMK у вас появится сигарета")
      imgui.EndChild()
      imgui.BeginChild("##bar_bar", imgui.ImVec2(300, 120), true, imgui.WindowFlags.NoScrollbar)
      imgui.Checkbox(u8"Часы", time)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочетании клавиш EZ вы посмотрите на часы")
      imgui.Checkbox(u8"Закрытие транспорта", lock)
      imgui.SameLine()
      imgui.TextQuestion(u8"При нажатии на клавишу L вы закроете/откроете свой транспорт")
      imgui.Checkbox(u8"Закрытие аренды", jlock)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочитании клвиш  JL вы закроете/откроете свой арендованный транспорт")
      imgui.EndChild()
      if imgui.Button(u8'Сохранить настройки',imgui.ImVec2(150,65)) then
      mainIni.config.lic = lic.v
      mainIni.config.trade = trade.v
      mainIni.config.tlf = tlf.v
      mainIni.config.arm = arm.v
      mainIni.config.msk = msk.v
      mainIni.config.smk = smk.v
      mainIni.config.time = time.v
      mainIni.config.lock = lock.v
      mainIni.config.jlock = jlock.v
      mainIni.config.fcar = fcar.v
      mainIni.config.recar = recar.v
      mainIni.config.key = key.v
      mainIni.config.vr = vr.v
      mainIni.config.setwaiter = setwaiter.v
      mainIni.config.aut = aut.v
      mainIni.config.abc = abc.v
      mainIni.config.waitb = waitb.v
      mainIni.config.acd = acd.v
      mainIni.config.mbc = mbc.v
      mainIni.config.at = at.v
      inicfg.save(mainIni, 'ARZ HotKeys.ini')
      end
      imgui.SetCursorPos(imgui.ImVec2(325, 61))
      imgui.BeginChild("##ear_bar", imgui.ImVec2(350, 120), true, imgui.WindowFlags.NoScrollbar)
      imgui.Checkbox(u8"Заправить авто", fcar)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочитании клвишь  CAN вы заправите транспорт используя канистру")
      imgui.Checkbox(u8"Починить авто", recar)
      imgui.SameLine()
      imgui.TextQuestion(u8"При сочитании клвишь  RECAR вы почините транспорт используя ремкомплект")
      imgui.Checkbox(u8"Ключи от авто", key)
      imgui.SameLine()
      imgui.TextQuestion(u8"При нажатии на клавиру K вы вставите/заберете ключи")
      imgui.EndChild()
      imgui.SetCursorPos(imgui.ImVec2(325, 189))
      imgui.BeginChild("##g_leftbar", imgui.ImVec2(350, 150), true, imgui.WindowFlags.NoScrollbar)
      imgui.Checkbox(u8"Авто скип ответа на репорт", aut)
      imgui.SameLine()
      imgui.TextQuestion(u8"Как только скрипт увидит ответ администратора он пропустит диалог")
      imgui.Checkbox(u8"Реклама в вип-чат", vr)
      imgui.InputText(u8"Сообщение", chatsms)
      imgui.SameLine()
      imgui.TextQuestion(u8"Это сообщение будет писатся в вип-чат с установленной вами задержкой")
      imgui.SliderInt('Wait', setwaiter, 10000, 30000)
      imgui.SameLine()
      imgui.TextQuestion(u8"10000 - 10с, указывается в милисекундах")
      imgui.EndChild()
      imgui.SetCursorPos(imgui.ImVec2(325, 348))
      imgui.BeginChild("##g_pftbar", imgui.ImVec2(350, 160), true, imgui.WindowFlags.NoScrollbar)
      imgui.Checkbox(u8"Авто закрытие дверей авто", acd)
      imgui.SameLine()
      imgui.TextQuestion(u8"Как только скрипт увидит что вы словили авто по госсу он автоматически закроет двери авто")
      imgui.Checkbox(u8"Сообщение после покупки авто", mbc)
      imgui.SameLine()
      imgui.TextQuestion(u8"Это сообщение отправится после покупки авто, по умолчанию стоит EZ car")
      imgui.InputText(u8"Сообщение", smsbc)
      imgui.Checkbox(u8"Авто тайм после ловли", at)
      imgui.SameLine()
      imgui.TextQuestion(u8"После удачной ловли скрипт сам пропишет /time с отыгровкой")
      imgui.EndChild()
      imgui.SetCursorPos(imgui.ImVec2(175, 445))
      if imgui.Button(u8"Перезагрузить скрипт", imgui.ImVec2(140,65)) then
            thisScript():reload()
        end
     end
   imgui.End()
end
function main()
    while not isSampAvailable() do wait(100) end
    print("По всем багам писать Автору: https://vk.com/mq228_suqa1488")
    sampRegisterChatCommand('fh', function(num)
    if num ~= nil then
        sampSendChat('/findihouse '..num)
        end
    end)
      notf.addNotification("Скрипт был успешно загружен", 5, 1)
      while true do
      wait(0)
    if lic.v and wasKeyPressed(0x31) and isKeyDown(0x12) then
                local veh, ped = storeClosestEntities(PLAYER_PED)
                local _, id = sampGetPlayerIdByCharHandle(ped)
                if id then
                    sampSendChat('/showskill '..id)
                end
            end
    if trade.v and wasKeyPressed(0x32) and isKeyDown(0x12) then
                local veh, ped = storeClosestEntities(PLAYER_PED)
                local _, id = sampGetPlayerIdByCharHandle(ped)
                if _ then
                    sampSendChat('/trade '..id)
                end
            end
    if tlf.v and wasKeyPressed(0x50) and not sampIsCursorActive() then
        sampSendChat("/phone")
    end
    if arm.v then
        if testCheat("arm") and not sampIsChatInputActive() then
            sampSendChat("/me используя магию надел бронежилет")
            sampSendChat("/armour")
        end
    end
    if msk.v then
        if testCheat("mask") and not sampIsCursorActive() then
            sampSendChat("/mask")
        end
    end
    if time.v then
        if testCheat("ez") and not sampIsCursorActive() then
            sampSendChat("/me взглянул на часы с гравировкой •Бан по причине пидорас• ")
            sampSendChat("/time")
             wait(1200)
            sampSendChat ("/do На часах  "..os.date('%H:%M:%S'))
        end
    end
    if vr.v then
        sampSendChat(u8:decode(chatsms.v))
        wait(setwaiter.v)
    end    
    if lock.v and not sampIsCursorActive() then
        if testCheat("l") then
            sampSendChat("/lock")
        end
    end
    if jlock.v and not sampIsCursorActive() then
        if testCheat("jl") then
            sampSendChat("/jlock")
        end
    end
    if fcar.v and not sampIsCursorActive() then
        if testCheat("can") then
            sampSendChat("/fillcar")
        end
    end
    if testCheat("eda") then
        sampSendClickTextdraw(673)
    end
    if recar.v and not sampIsCursorActive() then
        if testCheat("recar") then
            sampSendChat("/repcar")
        end
    end
    if key.v and not sampIsCursorActive() then
        if testCheat("k") then
            sampSendChat("/key")
        end
    end
    if testCheat("RR") and not sampIsCursorActive() then
        main_window_state.v = not main_window_state.v
       end
       imgui.Process = main_window_state.v
       end
end
function hook.onServerMessage(color, text)
  if acd.v then
        if text:find("Поздравляем! Теперь этот транспорт принадлежит вам!") and not text:find('говорит') and not text:find('- |') then
            sampSendChat('/lock')
        end
   end
   lua_thread.create(function()
     if mbc.v then
           if text:find("Поздравляем! Теперь этот транспорт принадлежит вам!") and not text:find('говорит') and not text:find('- |') then
               wait(500)
               sampSendChat(u8:decode(smsbc.v))
            end
        end
    end)
    lua_thread.create(function()
        if at.v then
            if text:find("Поздравляем! Теперь этот транспорт принадлежит вам!") or text:find("(.-)Поздравляю! Теперь этот дом ваш!")  and not text:find('говорит') and not text:find('- |') then
                sampSendChat("/me взглянул на часы с гравировкой •Топ ловец•")
                sampSendChat("/time")
                wait(1200)
                sampSendChat ("/do На часах  "..os.date('%H:%M:%S'))
                end
            end
        end)
end
function hook.onShowDialog(dialogId, dialogStyle, dialogTitle, okButtonText, cancelButtonText, dialogText)
    if aut.v then
       if dialogId == 1333 then
            setVirtualKeyDown(13, false)
        end
       if dialogId == 1332 then
            setVirtualKeyDown(13, false)
        end
    end
    if tlf.v then
        if dialogId == 1000 then
            setVirtualKeyDown(13,false)
        end
    end
end

function apply_custom_style()
    if not state then
  imgui.SwitchContext()
  local style = imgui.GetStyle()
   local colors = style.Colors
   local clr = imgui.Col
   local ImVec4 = imgui.ImVec4
   local ImVec2 = imgui.ImVec2
     style.WindowPadding = ImVec2(15, 15)
     style.WindowRounding = 5.0
     style.FramePadding = ImVec2(5, 5)
     style.FrameRounding = 4.0
     style.ItemSpacing = ImVec2(12, 8)
     style.ItemInnerSpacing = ImVec2(8, 6)
     style.IndentSpacing = 25.0
     style.ScrollbarSize = 15.0
     style.ScrollbarRounding = 9.0
     style.GrabMinSize = 5.0
     style.GrabRounding = 3.0

     colors[clr.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
     colors[clr.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
     colors[clr.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
     colors[clr.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
     colors[clr.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
     colors[clr.Border] = ImVec4(0.80, 0.80, 0.83, 0.88)
     colors[clr.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
     colors[clr.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
     colors[clr.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
     colors[clr.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
     colors[clr.TitleBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
     colors[clr.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
     colors[clr.TitleBgActive] = ImVec4(0.07, 0.07, 0.09, 1.00)
     colors[clr.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
     colors[clr.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
     colors[clr.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
     colors[clr.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
     colors[clr.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
     colors[clr.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
     colors[clr.CheckMark] = ImVec4(0.80, 0.80, 0.83, 0.31)
     colors[clr.SliderGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
     colors[clr.SliderGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
     colors[clr.Button] = ImVec4(0.10, 0.09, 0.12, 1.00)
     colors[clr.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
     colors[clr.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
     colors[clr.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
     colors[clr.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
     colors[clr.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
     colors[clr.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
     colors[clr.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
     colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
     colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
     colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
     colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
     colors[clr.PlotLines] = ImVec4(0.40, 0.39, 0.38, 0.63)
     colors[clr.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
     colors[clr.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
     colors[clr.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
     colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
     colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
    end
end
apply_custom_style()

function imgui.TextQuestion(text)
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end
При закрытие на крестикПосмотреть вложение 34510
акутульненько
 

Zatvornik

Новичок
29
1
Проблема с массивом, help. Если переменную slovo изобразить как "slovo = "ttt"", то работает, а так как на примере ниже - нет.

Lua:
local slovo = {"ttt", "aaa"}

function SE.onServerMessage(color, text)
    if string.find(text, '<ADM> %((%d+) уровень%) (.*)%[(%d+)%]%: %/' .. slovo) then
        nadovidat  = text:match('<ADM> %(%d+ уровень%) .+: (.+)')
    end
end
 

earthlord

Известный
135
34
в каком-то плагине видел, что при несанкционированном завершении плагина в чат пишет о том, что он крашнулся. как такое реализовать?
 

#Northn

Police Helper «Reborn» — уже ШЕСТЬ лет!
Всефорумный модератор
2,635
2,485
Проблема с массивом, help. Если переменную slovo изобразить как "slovo = "ttt"", то работает, а так как на примере ниже - нет.

Lua:
local slovo = {"ttt", "aaa"}

function SE.onServerMessage(color, text)
    if string.find(text, '<ADM> %((%d+) уровень%) (.*)%[(%d+)%]%: %/' .. slovo) then
        nadovidat  = text:match('<ADM> %(%d+ уровень%) .+: (.+)')
    end
end

Lua:
local slovo = {"ttt", "aaa"}

function SE.onServerMessage(color, text)
   for _, h in pairs(slovo) do
      if string.find(text, '<ADM> %((%d+) уровень%) (.*)%[(%d+)%]%: %/' .. h) then
          nadovidat  = text:match('<ADM> %(%d+ уровень%) .+: (.+)')
          break
      end
   end
end
 

Leatington

Известный
258
71
sampRegisterChatCommand('credit', function(arg)
local id, price, why = arg:match('(%d+) (%d+) %s+(.+)') ID = id price = price cause = why
end

/credit 123 10000 за хорошие глазки

помогите мне пожалуйста с регулярками у меня нихера не получаеться, команда продемонстрирована выше выше
(%d+)%s(%d+)%s(.*)
 
  • Нравится
Реакции: KH9I3b_MuJIOCJIABCKu

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
куда обратиться, чтобы в скрипте убрали лишний мусор и исправили где неправильно?
 

sdfaw

Активный
718
150
как сделать чтобы при открытии imgui сразу открывалась нужная imgui.Selectable?
 

Zatvornik

Новичок
29
1
По дефолту каждая новая строчка в imgui.Text идет вертикально вниз, а как сделать так, чтобы она шла вправо?