Фигня какая то со скриптом.

P0M61K

Активный
Автор темы
264
54
При включеном состоянии не выключается по повторному введению команды. Хотя код правильный вроде.

Lua:
script_name("tr")
script_author("P0M61K")
local ACTIVATION_COMMAND = "/trka"

local events = require 'lib.samp.events'
local activ = true
local trka = 0

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("Script launch", 0x00DD00)
    sampRegisterChatCommand(ACTIVATION_COMMAND:match("/(%a+)"), setActivation)
    while true do wait(100)
        local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        local _, health = sampGetPlayerHealth(id)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) and cmdact == 1 then
            sampAddChatMessage("Player playng", 0x00DD00)
            if health < 50 and trka == 1 then
                sampAddChatMessage("Deagle", 0x00DD00)
                sampAddChatMessage("M4", 0x00DD00)
                local trka = 0
            end
        end
   
        if health == 100 and trka == 0 then
            local trka = 1
        end
    end
end

function setActivation()
    if activ then
        cmdact = 1
        sampAddChatMessage("TR: ON", 16711680)
    else
        cmdact = 0
        sampAddChatMessage("TR: OFF", 65280)
    end
    activ = not activ
end
Сам решил
 
Последнее редактирование: