Автопиар через /ad для СМИшника

Porn Hub

Известный
Автор темы
309
86
В общем и целом господа.
Нужен такой скриптик, что бы кидал /ad "что-то тут, что-то там, аля реклама", потом ловил его, и редачил. Другие объявления не нужно трогать, только от себя которые.
 
Решение
Lua:
local sampev = require('lib.samp.events')

local obyava = '' -- твоё объявление
local adnick = ''
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+)') then
            adnick = text:match('На обработку объявлений пришло сообщение от: (%w+)')
            if sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))):find(adnick) then...

fokichevskiy

Известный
478
247
Lua:
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 == sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) then
                lua_thread.create(sendalt)
            end
        end
    end
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if active then
        if dialogId == 25477 then
            local count = -1
            for n in text:gmatch('[^\r\n]+') do
                if n:find('San Fierro') then -- city без тире и на английском
                    sampSendDialogResponse(dialogId, 1, count, '')
                end
                count = count + 1
            end
        elseif dialogId == 15346 then
            local count = -1
            for n in text:gmatch('[^\r\n]+') do
                if n:find('Обычное') then
                    sampSendDialogResponse(dialogId, 1, count, '')
                end
                count = count + 1
            end
        elseif dialogId == 15347 then
            sampSendDialogResponse(dialogId, 1, 0, '')
        elseif dialogId == 25896 then
            sampSendDialogResponse(dialogId, 1, 0, '')
        elseif dialogId == 556 then
            local count = -1
            for n in text:gmatch('[^\r\n]+') do
                if n:find(sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))) then
                    sampSendDialogResponse(556, 1, count, '')
                end
                count = count + 1
            end
        elseif dialogId == 557 then
            sampSendDialogResponse(557, 1, 0, 'ну там че те надо типа') -- поменяй
            active = false
        end
    end
end

function sendalt()
    setGameKeyState(21, -256)
    wait(200)
    setGameKeyState(21, 0)
end
вот, из своего кода вырезал, поменяй что надо где комментарии
 

Porn Hub

Известный
Автор темы
309
86
1723846321632.png

Чет на этом моменте тормозит
 

fokichevskiy

Известный
478
247
Lua:
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 == sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) then
                lua_thread.create(sendalt)
            end
        end
    end
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if active then
        if dialogId == 25612 then
            sampSendDialogResponse(dialogId, 1, 0, '')
        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
        elseif dialogId == 25614 then
            sampSendDialogResponse(25614, 1, 0, 'ну там че те надо типа') -- поменяй
            active = false
        end
    end
end

function sendalt()
    setGameKeyState(21, -256)
    wait(200)
    setGameKeyState(21, 0)
end
если сообщения в чате такие же и ты мне скинул все диалоги, то должно работать
 

fokichevskiy

Известный
478
247
Lua:
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 == 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, '')
        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
        elseif dialogId == 25614 then
            sampSendDialogResponse(25614, 1, 0, 'ну там че те надо типа') -- поменяй
            active = false
        end
    end
end
ну получается вот
 

Porn Hub

Известный
Автор темы
309
86
Все равно тормозит на окне 25612, можно туда добавить что бы энтер тыкнул ?

249446
на этом моменте
Хотя пишет в чат что отправлено уже, и если ввести в ручную /newsredak, а потом выбрать свою объяву, то он её редачит и отправляет
 

fokichevskiy

Известный
478
247
Lua:
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 == 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
 

Porn Hub

Известный
Автор темы
309
86
1723848535158.png
Диалога никакого нету, но и не происходит ничего =_=

Я что-то щас подумал, может быть это из-за того что твоя система определяет мой ник не правильно ?
Потому что в табе на вс перед ником [id сервера], а в чате пишется просто ник