local sampev = require('lib.samp.events') local state = false function main() while not isSampAvailable() do wait(0) end sampRegisterChatCommand('fticket', function () state = not state sampAddChatMessage(state and 'ON' or 'OFF', -1) end) wait(-1) end function sampev.onShowTextDraw(id, data) if state then if data.text == 'LD_BEAT:chit' and data.selectable == 1 and data.letterColor == 520093695 then sampSendClickTextdraw(id) end end end function sampev.onShowDialog(id, style, title, button1, button2, text) if state then if text:find('%{......%}У Вас еще имеются неоткрытые билеты, желаете продолжить открывать%?') then lua_thread.create_suspended(function() wait(4000) sampSendDialogResponse(id, 1, 0, 0) end):run() return false end end end