raksamp saveacc

nend

Участник
Автор темы
144
11
Решил написать свой скрипт, однако работает всё кроме сохранения аккаунтов

lua:
function sampev.onDisplayGameText(style, time, text) -- Comfort
    newTask(function ()
        if text:find('Поздравляю! Вы достигли 4-го уровня!') then
            writeTxt("accounts\\good.txt", ("%s | %s | %s | %s| %s"):format(getBotNick(), pass, getBotScore(), getBotMoney(), current_server))
            setRandomNick()
        end
        if text:find('Поздравляю! Вы достигли') then
            writeTxt("accounts\\payday.txt", ("%s | %s | %s | %s| %s| %s"):format(getBotNick(), pass, getBotScore(), getBotMoney(), current_server, time))
        end
    end)
end

после получения текста ничего скрипт не выписывает
скрипт находится в папке scripts
accounts находится в корне раксампа

попробовал папку закинуть в scripts, не помогло
 
Решение
так хукай сообщение в чате, а не геймтекст
Lua:
function sampev.onDisplayGameText(clr, text)
    if text:find('Поздравляю! Вы достигли 4-го уровня!') then
        writeTxt("accounts\\good.txt", ("%s | %s | %s | %s| %s"):format(getBotNick(), pass, getBotScore(), getBotMoney(), current_server))
        setRandomNick()
    end
    if text:find('Поздравляю! Вы достигли') then
        writeTxt("accounts\\payday.txt", ("%s | %s | %s | %s| %s| %s"):format(getBotNick(), pass, getBotScore(), getBotMoney(), current_server, time))
    end
end

minxty

Известный
885
768
так хукай сообщение в чате, а не геймтекст
Lua:
function sampev.onDisplayGameText(clr, text)
    if text:find('Поздравляю! Вы достигли 4-го уровня!') then
        writeTxt("accounts\\good.txt", ("%s | %s | %s | %s| %s"):format(getBotNick(), pass, getBotScore(), getBotMoney(), current_server))
        setRandomNick()
    end
    if text:find('Поздравляю! Вы достигли') then
        writeTxt("accounts\\payday.txt", ("%s | %s | %s | %s| %s| %s"):format(getBotNick(), pass, getBotScore(), getBotMoney(), current_server, time))
    end
end
 
  • Нравится
Реакции: nend