local sampev = require('lib.samp.events')
local obyava = '' -- твоё объявление
local active = false
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('cmd', function ()
active = true
sampAddChatMessage('отправляем...', -1)
sampProcessChatInput('/ad ' .. obyava)
end)
wait(-1)
end
function sampev.onServerMessage(color, text)
if active then
if text:match('На обработку объявлений пришло сообщение от: (%w+_%w+)') then
local adnick = text:match('На обработку объявлений пришло сообщение от: (%w+_%w+)')
if adnick:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))) then
sampProcessChatInput('/newsredak')
end
end
end
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if active then
if dialogId == 25612 then
sampSendDialogResponse(dialogId, 1, 0, '')
return false
elseif dialogId == 25613 then
local count = -1
for n in text:gmatch('[^\r\n]+') do
if n:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))) then
sampSendDialogResponse(25613, 1, count, '')
end
count = count + 1
end
return false
elseif dialogId == 25614 then
sampSendDialogResponse(25614, 1, 0, 'ну там че те надо типа') -- поменяй
active = false
return false
end
end
end