Postado Março 28, 2023 2 anos 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!
Postado Maio 1, 2023 2 anos 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 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
Postado Maio 18, 2023 2 anos 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 Maio 18, 2023 2 anos por yuriowns (veja o histórico de edições)
Postado Maio 18, 2023 2 anos 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! Contato :https://www.linkedin.com/in/rafhael-oliveira/Projetos :https://github.com/thetibiaking
Postado Maio 22, 2023 2 anos Autor Em 18/05/2023 em 23:26, Underewar disse: Dei uma melhorada no tópico para ficar melhor de entender a instalação! Eu fiz daquele jeito e deu o erro no event advance, parece q não existe esse event no meu servidor
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.