Падение фпс в скрипте

Qlliman

Участник
Автор темы
38
1
Версия SA-MP
  1. Любая
Очень сильно падает фпс когда скрипт выключен(40-60 кадров). Когда скрипт включен, фпс возвращается в норму (90-100). Скрипт убирает худ, карту и текстдравы, что дает картинку как в кино
Lua:
script_name('Looters Film Maker')
local sampev = require 'lib.samp.events'
local tds = {4, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2075, 2076, 2077, 2078, 2079, 2080, 2091, 2092, 2093, 2095, 2094, 2089, 2090, 2085, 2084, 2081, 2082, 2083, 2104, 2105, 2106, 2086, 2087, 2088}

act = false

function main()
    while not isSampAvailable() do wait(100) end
        wait(5000)
      sampAddChatMessage("[Looters Film Maker] {FFFFFF}Скрипт был успешно загружен. Автор: {FFD700}The Qlliman", 0xFFD700)
      sampAddChatMessage("[Looters Film Maker] {FFFFFF}Активация скрипта - /act", 0xFFD700)
    sampRegisterChatCommand('act', function ()
        act = not act
        sampAddChatMessage(act and '{FFD700}['..thisScript().name..']{FFFFFF} Интерфейс и ники отключены' or '{FFD700}['..thisScript().name..']{FFFFFF} Интерфейс и ники включены', -1)
    end)

    while true do
        wait(0)
        if act then
            sampSetChatDisplayMode(0)
            displayHud(false)
            for a = 0, 2304    do --cycle trough all textdeaw id
                if sampTextdrawIsExists(a) then
                    sampTextdrawDelete(a)
                end
            end
        else
            sampSetChatDisplayMode(2)
            displayHud(true)
        end
    end
end
function sampev.onShowTextDraw(id, data)
    table.insert(tds,id)
    if act then
        for i = 1, #tds do
            if id == tds[i] then
                table.remove(tds,id)
                return false
            end
        end
    end
end
local gangId  = {}
function sampev.onCreateGangZone(zoneId, squareStart, squareEnd, color)
    table.insert(gangId,zoneId)
    if act then
        for i = 1, #gangId do
            if zoneId == gangId[i] then
                table.remove(tds,id)
                return false
            end
        end
    end
end
Также ищу анлокер фпс, который дает возможность держать конкретный фпс, а если в виде кода, то вообще секас
 

Maxim25012

Известный
280
101
Ну, так конечно, ты же каждый кадр проверяешь текстдравы по две тысячи раз. Один раз так сделать – ещё простительно, а вот каждый кадр – нет. Лучше сделать так, чтобы после активации все текстдравы один раз удалились, а новые игнорировались.
 

Gorskin

I shit on you
Проверенный
1,247
1,043
чет все ровно не понимаю куда и как
Lua:
script_name('Looters Film Maker')
local sampev = require 'lib.samp.events'
local tds = {4, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2075, 2076, 2077, 2078, 2079, 2080, 2091, 2092, 2093, 2095, 2094, 2089, 2090, 2085, 2084, 2081, 2082, 2083, 2104, 2105, 2106, 2086, 2087, 2088}

act = false

function main()
    while not isSampAvailable() do wait(100) end
    wait(5000)
    sampAddChatMessage("[Looters Film Maker] {FFFFFF}Скрипт был успешно загружен. Автор: {FFD700}The Qlliman", 0xFFD700)
    sampAddChatMessage("[Looters Film Maker] {FFFFFF}Активация скрипта - /act", 0xFFD700)
    sampRegisterChatCommand('act', function ()
        act = not act
        
        if act then
            sampSetChatDisplayMode(0)
            displayHud(false)
            for a = 0, 2304    do --cycle trough all textdeaw id
                if sampTextdrawIsExists(a) then
                    sampTextdrawDelete(a)
                end
            end
        else
            sampSetChatDisplayMode(2)
            displayHud(true)
        end

        sampAddChatMessage(act and '{FFD700}['..thisScript().name..']{FFFFFF} Интерфейс и ники отключены' or '{FFD700}['..thisScript().name..']{FFFFFF} Интерфейс и ники включены', -1)
    end)

    wait(-1)
end

function sampev.onShowTextDraw(id, data)
    table.insert(tds,id)
    if act then
        for i = 1, #tds do
            if id == tds[i] then
                table.remove(tds,id)
                return false
            end
        end
    end
end

local gangId  = {}

function sampev.onCreateGangZone(zoneId, squareStart, squareEnd, color)
    table.insert(gangId,zoneId)
    if act then
        for i = 1, #gangId do
            if zoneId == gangId[i] then
                table.remove(tds,id)
                return false
            end
        end
    end
end

В чем проблема?
 
  • Нравится
Реакции: Qlliman