script_author(Slent)
script_name(AutoCatchingAds)
local sampev = require 'lib.samp.events'
local keys = require 'vkeys'
local enabled = false
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('aca', function()
enabled = not enabled
sampAddChatMessage(enabled and '{00FF00}Ловля обьявлений активирована' or '{FF0000}Ловля обьявлений деактивирована', -1)
end)
while true do wait(0)
if isKeyDown(66) and not (sampIsDialogActive() and sampGetCurrentDialogId() == 557) and not (sampIsDialogActive() and sampGetCurrentDialogId() == 556) then
wait(50)
sampSendChat("/newsredak")
end
end
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if enabled then
lua_thread.create(function()
wait(0)
if dialogId == 0 then
sampCloseCurrentDialogWithButton(1)
end
if dialogId == 556 then
sampSendDialogResponse(556,1,0,0)
wait(10)
sampCloseCurrentDialogWithButton(1)
end
end)
end
end