script_name("Coordinates")
local inicfg = require("inicfg")
local path = thisScript().name
local ini = inicfg.load({
set = {
x = 500,
y = 500
}
}, path)
local font = renderCreateFont("Arial", 10, 13)
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("savecoord", save) -- Добавить координаты в буфер.
sampRegisterChatCommand("coordpos", changepos) -- Изменить положения отображение координат на экране.
while true do wait(0)
--By Armor
X, Y, Z = getCharCoordinates(PLAYER_PED)
renderFontDrawText(font, '{ED8C23}X: {FFFFFF}' .. math.floor(X) .. '\n{ED8C23}Y: {FFFFFF}' .. math.floor(Y) .. '\n{ED8C23}Z: {FFFFFF}' .. math.floor(Z), ini.set.x, ini.set.y, 0xFFFFFFFF)
end
end
function save()
X, Y, Z = getCharCoordinates(PLAYER_PED)
local format = string.format("%s, %s, %s", math.floor(X), math.floor(Y), math.floor(Z))
setClipboardText(format)
sampAddChatMessage("Координаты добавлены в буфер обмена: " .. format, 0xFFFFFFFF)
end
function changepos()
lua_thread.create(function()
while not isKeyJustPressed(0x01) do wait(0)
sampSetCursorMode(4)
ini.set.x, ini.set.y = getCursorPos()
end
sampSetCursorMode(0)
inicfg.save(ini, path)
end)
end