Нужен скрипт для записывания маршрутов на самолете

fopzzys

Новичок
Автор темы
29
3
Нужен скрипт для записывания маршрутов для самолёта и с ног
 

James Fenrir

Участник
36
7
Нужен скрипт для записывания маршрутов для самолёта и с ног
Lua:
script_name('GPS')
script_author('хуй знает')

local sampev = require 'lib.samp.events'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local isRecording = false
local outputFile = nil
local mode = "airplane"

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(u8:decode("Маршрутоcоставитель запущен. Нажмите F5 для записи маршрута."), -1)

    while true do
        wait(0)
        if wasKeyPressed(vk.F5) then
            toggleRecording()
        end

        if isRecording then
            local x, y, z = getCharCoordinates(PLAYER_PED)
            writeToFile(string.format("%s: %.3f, %.3f, %.3f\n", mode, x, y, z))
            wait(1000)
        end
    end
end

function toggleRecording()
    isRecording = not isRecording

    if isRecording then
        local filename = os.date("route_%Y%m%d_%H%M%S.txt")
        outputFile = io.open(filename, "w")
        if outputFile then
            sampAddChatMessage(u8:decode("Запись начата: " .. filename), -1)
        else
            sampAddChatMessage(u8:decode("Ошибка открытия файла."), -1)
            isRecording = false
        end
    else
        if outputFile then
            outputFile:close()
            outputFile = nil
            sampAddChatMessage(u8:decode("Запись остановлена."), -1)
        end
    end
end

function writeToFile(text)
    if outputFile then
        outputFile:write(text)
        outputFile:flush()
    end
end

function isKeyPressed(key)
    return isKeyDown(key)
end
Активация F5 как бы, я даже не проверял работает ли, хуй его знает, чекнешь как сможешь
 

fopzzys

Новичок
Автор темы
29
3
Lua:
script_name('GPS')
script_author('хуй знает')

local sampev = require 'lib.samp.events'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local isRecording = false
local outputFile = nil
local mode = "airplane"

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(u8:decode("Маршрутоcоставитель запущен. Нажмите F5 для записи маршрута."), -1)

    while true do
        wait(0)
        if wasKeyPressed(vk.F5) then
            toggleRecording()
        end

        if isRecording then
            local x, y, z = getCharCoordinates(PLAYER_PED)
            writeToFile(string.format("%s: %.3f, %.3f, %.3f\n", mode, x, y, z))
            wait(1000)
        end
    end
end

function toggleRecording()
    isRecording = not isRecording

    if isRecording then
        local filename = os.date("route_%Y%m%d_%H%M%S.txt")
        outputFile = io.open(filename, "w")
        if outputFile then
            sampAddChatMessage(u8:decode("Запись начата: " .. filename), -1)
        else
            sampAddChatMessage(u8:decode("Ошибка открытия файла."), -1)
            isRecording = false
        end
    else
        if outputFile then
            outputFile:close()
            outputFile = nil
            sampAddChatMessage(u8:decode("Запись остановлена."), -1)
        end
    end
end

function writeToFile(text)
    if outputFile then
        outputFile:write(text)
        outputFile:flush()
    end
end

function isKeyPressed(key)
    return isKeyDown(key)
end
Активация F5 как бы, я даже не проверял работает ли, хуй его знает, чекнешь как сможешь
кнопку на какой строчке менять? f5 просто показывает скок человек в зоне стрима, и скрипт тож не запускается
 

James Fenrir

Участник
36
7
кнопку на какой строчке менять? f5 просто показывает скок человек в зоне стрима, и скрипт тож не запускается
Кнопка F5 включает его или выключает, щас поменяю на F7
Lua:
script_name('gps маршрут')
script_author('ку лох')

local sampev = require 'lib.samp.events'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local isRecording = false
local outputFile = nil
local mode = "airplane"

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(u8:decode("Маршрутоcоставитель запущен. Нажмите F7 для записи маршрута."), -1)

    while true do
        wait(0)
        if wasKeyPressed(vk.F7) then
            toggleRecording()
        end

        if isRecording then
            local x, y, z = getCharCoordinates(PLAYER_PED)
            writeToFile(string.format("%s: %.3f, %.3f, %.3f\n", mode, x, y, z))
            wait(1000)
        end
    end
end

function toggleRecording()
    isRecording = not isRecording

    if isRecording then
        local filename = os.date("route_%Y%m%d_%H%M%S.txt")
        outputFile = io.open(filename, "w")
        if outputFile then
            sampAddChatMessage(u8:decode("Запись начата: " .. filename), -1)
        else
            sampAddChatMessage(u8:decode("Ошибка открытия файла."), -1)
            isRecording = false
        end
    else
        if outputFile then
            outputFile:close()
            outputFile = nil
            sampAddChatMessage(u8:decode("Запись остановлена."), -1)
        end
    end
end

function writeToFile(text)
    if outputFile then
        outputFile:write(text)
        outputFile:flush()
    end
end

function isKeyPressed(key)
    return isKeyDown(key)
end
проверяй