не работает функция

copypaste_scripter

Известный
Автор темы
1,218
223
Версия MoonLoader
Другое
Lua:
require "lib.moonloader"
local sampev = require 'lib.samp.events'
--local trashid1, trashid2, trashid3, trashid4, trashid5, trashid6, trashid7, trashid8, trashid9 = 0,0,0,0,0,0,0,0,0

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    
    sampRegisterChatCommand('/trash', function()
        sampAddChatMessage('removing trash bug', -1)
        lua_thread.create(function()
            sampTextdrawDelete(trash1)
            sampTextdrawDelete(trash2)
            sampTextdrawDelete(trash3)
            sampTextdrawDelete(trash4)
            sampTextdrawDelete(trash5)
            sampTextdrawDelete(trash6)
            sampTextdrawDelete(trash7)
            sampTextdrawDelete(trash8)
            sampTextdrawDelete(trash9)
        end)
    end)
end

function sampev.onShowTextDraw(id, data)
    if math.floor(data.position.x) == 160 and math.floor(data.position.y) == 405 then trash1 = id end
    if math.floor(data.position.x) == 162 and math.floor(data.position.y) == 144 then trash2 = id end
    if math.floor(data.position.x) == 215 and math.floor(data.position.y) == 385 then trash3 = id end
    if math.floor(data.position.x) == 226 and math.floor(data.position.y) == 385 then trash4 = id end
    if math.floor(data.position.x) == 237 and math.floor(data.position.y) == 385 then trash5 = id end
    if math.floor(data.position.x) == 248 and math.floor(data.position.y) == 385 then trash6 = id end
    if math.floor(data.position.x) == 260 and math.floor(data.position.y) == 385 then trash7 = id end
    if math.floor(data.position.x) == 320 and math.floor(data.position.y) == 138 then trash8 = id end
    if math.floor(data.position.x) == 320 and math.floor(data.position.y) == 166 then trash9 = id end
end
короче на арз есть такой баг когда мусор открываешь иногда багается и зависает на экран, вот я написал скрипт фикс этого, но функция почему то не работает, по одному работает вроде, но все вместе нет, координаты достал все правильно, может что то не так увидите?