- 12
- 1
- Версия SA-MP
-
- Любая
Я написал скрипт который показывает сколько у меня Фпс на экране
зашел в игру и не работает помагите пожалуйста
-- Скрипт для отображения FPS в SAMP (MoonLoader)
require "lib.moonloader"
local inicfg = require "inicfg"
local font = renderCreateFont("Arial", 12, {bold = true})
local show_fps = true
local x, y = 10, 10
local color = 0xFFFFFFFF -- Белый цвет
-- Настройки по умолчанию
local config = {
show_fps = true,
x = 10,
y = 10,
color = 0xFFFFFFFF,
}
-- Загрузка настроек из файла
function loadConfig()
config = inicfg.load({settings = config}, "fps_display.ini")
show_fps = config.show_fps
x = config.x
y = config.y
color = config.color
end
-- Сохранение настроек в файл
function saveConfig()
inicfg.save({settings = config}, "fps_display.ini")
end
loadConfig()
function main()
if not isSampLoaded() or not isSampAvailable() then
return
end
while true do
wait(0)
if wasKeyPressed(VK_F11) then
show_fps = not show_fps
config.show_fps = show_fps
saveConfig()
sampAddChatMessage("[FPS Display]: " .. (show_fps and "Включено" or "Выключено"), -1)
end
if show_fps then
local fps = getFrameRate()
renderFontDrawText(font, string.format("FPS: %d", fps), x, y, color)
end
end
end
function onScriptTerminate()
renderDeleteFont(font)
end
function onKeyDown(vKey, nCode)
-- Пример изменения позиции текста (можно настроить на другие клавиши)
if vKey == VK_UP then
y = y - 1
config.y = y
saveConfig()
elseif vKey == VK_DOWN then
y = y + 1
config.y = y
saveConfig()
elseif vKey == VK_LEFT then
x = x - 1
config.x = x
saveConfig()
elseif vKey == VK_RIGHT then
x = x + 1
config.x = x
saveConfig()
end
end
[20:02:26] {C0C0C0}[ML] {FF7070}(error) {E0E0E0}Fps.lua: {C0C0C0}C:\Users\123\Desktop\Gater\moonloader\Fps.lua:59: attempt to call global 'renderDeleteFont' (a nil value)
Вложения
Последнее редактирование: