Помогите сделать автоактивацию

Улиточка

Активный
Автор темы
218
71
Нашел хороший скрипт для автоеды но не получается сделать его активным сразу при входе в игру, может кто помочь с этим?
Lua:
local samp = require 'samp.events'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("autoeat", function()
        activ = not activ
        sampAddChatMessage("{828282}Автохавчик "..(activ and "{00FF00}ВКЛ" or "{FF0000}ВЫКЛ"),-1)
    end)
    wait(-1)
end
function samp.onShowTextDraw(id,data)
    if activ and (data.text:find('You are hungry!') or data.text:find('You are very hungry!')) then
        sampSendChat('/jmeat')
    end
end
 

zxcultan

Потрачен
845
319
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Lua:
local samp = require "samp.events"

function samp.onShowTextDraw(id,data)
    if (data.text:find('You are hungry!') or data.text:find('You are very hungry!')) then
        sampSendChat('/jmeat')
    end
end
 
  • Влюблен
Реакции: Улиточка

KostLim

Известный
308
97
lua:
local samp = require 'samp.events'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("autoeat", function()
        activ = not activ
        sampAddChatMessage("{828282}Автохавчик "..(not activ and "{00FF00}ВКЛ" or "{FF0000}ВЫКЛ"),-1)
    end)
    wait(-1)
end
function samp.onShowTextDraw(id,data)
    if activ and (data.text:find('You are hungry!') or data.text:find('You are very hungry!')) then
        sampSendChat('/jmeat')
    end
end

вот версия, где по умолчанию скрипт включен, но при необходимости можно отключить. (не знаю, будет ли работать, нужно протестить)
 

zxcultan

Потрачен
845
319
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
lua:
local samp = require 'samp.events'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("autoeat", function()
        activ = not activ
        sampAddChatMessage("{828282}Автохавчик "..(not activ and "{00FF00}ВКЛ" or "{FF0000}ВЫКЛ"),-1)
    end)
    wait(-1)
end
function samp.onShowTextDraw(id,data)
    if activ and (data.text:find('You are hungry!') or data.text:find('You are very hungry!')) then
        sampSendChat('/jmeat')
    end
end

вот версия, где по умолчанию скрипт включен, но при необходимости можно отключить. (не знаю, будет ли работать, нужно протестить)
Господи, что с табуляцией?
А в чем разница с тем, что скинул тс? Это же единнтичный код