Ir para conteúdo

Featured Replies

Postado

Salve rapazeada, tranquilo? Preciso de um script de um anti-bot para TFS 1.0, mas eu gostaria que o script só ativasse quando um player matasse um número aleatório de 300 a 1000 bichos, procurei mas não encontrei nenhum, alguém teria? obrigado!

Resolvido por L3K0T

Ir para solução
  • 1 month later...
  • Respostas 5
  • Visualizações 560
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Ve se te ajuda data/creturescript/creaturescript.xnml.   <event type="advance" name="AntiBotAdvance" script="antibot_advance.lua"/> data/creturescript/antibot_advance.lua. loca

  • Dei uma melhorada no tópico para ficar melhor de entender a instalação!

Postado
  • Diretor
  • Solução
  Em 28/03/2023 em 00:24, yuriowns disse:

Salve rapazeada, tranquilo? Preciso de um script de um anti-bot para TFS 1.0, mas eu gostaria que o script só ativasse quando um player matasse um número aleatório de 300 a 1000 bichos, procurei mas não encontrei nenhum, alguém teria? obrigado!

 Ve se te ajuda

data/creturescript/creaturescript.xnml.
 

<event type="advance" name="AntiBotAdvance" script="antibot_advance.lua"/>

data/creturescript/antibot_advance.lua.

local creaturesToKill = math.random(300, 1000)
local antiBotStorage = 25631 -- armazena quantas criaturas o jogador matou
local antiBotTime = 30 -- tempo em segundos para o jogador matar o número de criaturas necessárias

function onKill(cid, target, lastHit)
    if isPlayer(cid) and isCreature(target) then
        local storageValue = getPlayerStorageValue(cid, antiBotStorage)
        if storageValue < creaturesToKill then
            setPlayerStorageValue(cid, antiBotStorage, storageValue + 1)
            if storageValue + 1 == creaturesToKill then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. creaturesToKill .. " criaturas! Por favor, resolva o anti-bot para continuar jogando.")
                setPlayerStorageValue(cid, antiBotStorage, -antiBotTime) -- inicia o tempo para o jogador resolver o anti-bot
            end
        end
    end
end



function onThink(interval, lastExecution)
    for _, playerId in ipairs(getPlayersOnline()) do
        local storageValue = getPlayerStorageValue(playerId, antiBotStorage)
        if storageValue > 0 then
            if storageValue < creaturesToKill then
                doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. storageValue .. " criaturas. Continue matando para resolver o anti-bot.")
            elseif storageValue == creaturesToKill then
                local timeLeft = getPlayerStorageValue(playerId, antiBotStorage) + antiBotTime - os.time()
                if timeLeft <= 0 then
                    doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Tempo esgotado para resolver o anti-bot. Você será desconectado em breve.")
                    doRemoveCreature(playerId)
                else
                    doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Por favor, resolva o anti-bot em " .. timeLeft .. " segundos para continuar jogando.")
                end
            end
        end
    end
    return true
end

 

data/creturescript/creaturescript.xnml.

<event type="login" name="AntiBotLogin" script="antibot_login.lua"/>

data/creturescript/antibot_login.lua.

function onLogin(cid)
    local storageValue = getPlayerStorageValue(cid, antiBotStorage)
    if storageValue > 0 then
        if storageValue < creaturesToKill then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. storageValue .. " criaturas. Continue matando para resolver o anti-bot.")
        elseif storageValue == creaturesToKill then
            local timeLeft = getPlayerStorageValue(cid, antiBotStorage) + antiBotTime - os.time()
            if timeLeft <= 0 then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Tempo esgotado para resolver o anti-bot. Você será desconectado em breve.")
                doRemoveCreature(cid)
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Por favor, resolva o anti-bot em " .. timeLeft .. " segundos para continuar jogando.")
            end
        end
    end
    return true
end

 

data/creturescript/creaturescript.xnml.

<event type="logout" name="AntiBotLogout" script="antibot_logout.lua"/>

data/creturescript/antibot_logout.lua

function onLogout(cid)
    setPlayerStorageValue(cid, antiBotStorage, 0)
    return true
end

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

  • 3 weeks later...
Postado
  • Autor
  Em 01/05/2023 em 22:50, L3K0T disse:

 Ve se te ajuda

 

 

<event type="advance" name="AntiBotAdvance" script="antibot_advance.lua"/>

 

local creaturesToKill = math.random(300, 1000)
local antiBotStorage = 25631 -- armazena quantas criaturas o jogador matou
local antiBotTime = 30 -- tempo em segundos para o jogador matar o número de criaturas necessárias

function onKill(cid, target, lastHit)
    if isPlayer(cid) and isCreature(target) then
        local storageValue = getPlayerStorageValue(cid, antiBotStorage)
        if storageValue < creaturesToKill then
            setPlayerStorageValue(cid, antiBotStorage, storageValue + 1)
            if storageValue + 1 == creaturesToKill then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. creaturesToKill .. " criaturas! Por favor, resolva o anti-bot para continuar jogando.")
                setPlayerStorageValue(cid, antiBotStorage, -antiBotTime) -- inicia o tempo para o jogador resolver o anti-bot
            end
        end
    end
end

 

function onThink(interval, lastExecution)
    for _, playerId in ipairs(getPlayersOnline()) do
        local storageValue = getPlayerStorageValue(playerId, antiBotStorage)
        if storageValue > 0 then
            if storageValue < creaturesToKill then
                doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. storageValue .. " criaturas. Continue matando para resolver o anti-bot.")
            elseif storageValue == creaturesToKill then
                local timeLeft = getPlayerStorageValue(playerId, antiBotStorage) + antiBotTime - os.time()
                if timeLeft <= 0 then
                    doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Tempo esgotado para resolver o anti-bot. Você será desconectado em breve.")
                    doRemoveCreature(playerId)
                else
                    doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Por favor, resolva o anti-bot em " .. timeLeft .. " segundos para continuar jogando.")
                end
            end
        end
    end
    return true
end

 

 

<event type="login" name="AntiBotLogin" script="antibot_login.lua"/>

 

function onLogin(cid)
    local storageValue = getPlayerStorageValue(cid, antiBotStorage)
    if storageValue > 0 then
        if storageValue < creaturesToKill then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. storageValue .. " criaturas. Continue matando para resolver o anti-bot.")
        elseif storageValue == creaturesToKill then
            local timeLeft = getPlayerStorageValue(cid, antiBotStorage) + antiBotTime - os.time()
            if timeLeft <= 0 then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Tempo esgotado para resolver o anti-bot. Você será desconectado em breve.")
                doRemoveCreature(cid)
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Por favor, resolva o anti-bot em " .. timeLeft .. " segundos para continuar jogando.")
            end
        end
    end
    return true
end

 

 

<event type="logout" name="AntiBotLogout" script="antibot_logout.lua"/>

 

function onLogout(cid)
    setPlayerStorageValue(cid, antiBotStorage, 0)
    return true
end

 

Boa tarde amigo, desculpe a demora, onde eu coloco cada script?

coloquei os 3 no creaturescripts e deu esse erro:
[Error - Event::checkScript] Event onAdvance not found (data/creaturescripts/scripts/antibot_advance.lua)

Editado por yuriowns (veja o histórico de edições)

Postado
  • Administrador
  Em 18/05/2023 em 20:17, yuriowns disse:

Boa tarde amigo, desculpe a demora, onde eu coloco cada script?

coloquei os 3 no creaturescripts e deu esse erro:
[Error - Event::checkScript] Event onAdvance not found (data/creaturescripts/scripts/antibot_advance.lua)

Dei uma melhorada no tópico para ficar melhor de entender a instalação!

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo