Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ## SCRIPT BY: Pedriinz ##
- ## CONTACT SKYPE: pedrosz4 ##
- ]]
- ANTI_BOT_SYSTEM = {
- config = {
- minMonstersToCheck = 5, -- O sistema irá escolher aleatoriamente um número de monstros entre esses dois valores para verificar.
- maxMonstersToCheck = 10,
- channelId = 11, -- Id do channel que será aberto para realizar a verificação.
- timeToAnswer = 50, -- Quanto tempo em segundos o jogador tem para responder a verificação.
- monstersForNotCheck = {'rotworm', 'bug', 'carrion worm', 'tiger'}, -- Monstros que não serão verificados pelo sistema.
- notations = 50000, -- Quantas notificações o jogador pode receber antes de ser banido.
- banDays = 0, -- Quantidade de dias o personagem vai ficar banido por utilizar bot.
- storageForNotations = 1222, -- Storage onde ficará salvo as notations.
- storageForOpenChat = 10383, -- Storage que permitira o chat ser aberto. (Aconselho não mudar).
- prision = {3301,2574,7}
- },
- questions = {
- [1] = {question = 'Digite "to aqui"', answer = 'to aqui'},
- [2] = {question = 'Digite "to aqui"', answer = 'to aqui'},
- [3] = {question = 'Digite "to aqui"', answer = 'to aqui'},
- --[numero seguinte] = {question = 'pergunta', answer = 'resposta'},
- },
- cache = {
- players = {
- --[player:getId()] = {count = 1}
- },
- question = 0,
- },
- messages = {
- reason = {msg = 'Voce foi preso por utilizar bot 100% AFK.'},
- notation = {msg = 'Voce foi penalizado e recebeu um notificacao.', type = MESSAGE_EVENT_ADVANCE},
- attention = {msg = '[Anti-Bot] Atencao! Voce so possui %d segundos para responder a verificacao.', type = TALKTYPE_CHANNEL_O},
- channel_enter = {msg = '[Anti-Bot] Voce esta sobre suspeitas de uso aplicativos nao autorizados.\nPor favor, confirme a verificacao a seguir, voce possui %d segundos para isso.', type = TALKTYPE_CHANNEL_O},
- channel_close = {msg = '[Anti-Bot] Para sua segurança, nao e possivel fechar este channel antes da verificacao. Por favor responda o que lhe foi perguntado para que nao seja penalizado.', type = TALKTYPE_CHANNEL_O},
- wrong_answer = {msg = '[Anti-Bot] Resposta errada, por favor tente novamente.', type = TALKTYPE_CHANNEL_O},
- correct_answer = {msg = '[Anti-Bot] Voce respondeu corretamente, obrigado e bom jogo! Voce ja pode fechar este channel.', type = TALKTYPE_CHANNEL_O},
- unconfirmed = {msg = 'Voce nao realizou a verificacao corretamente, por isso voce foi penalizado. Este channel ja pode ser fechado.', type = TALKTYPE_CHANNEL_O},
- }
- }
- function vericationBot(cid)
- local player = Player(cid)
- local timeNow = os.time()
- if not player then
- return true
- end
- if not ANTI_BOT_SYSTEM.cache.players[player:getId()] or ANTI_BOT_SYSTEM.cache.players[player:getId()].verified == false then
- return true
- else
- player:sendChannelMessage("", ANTI_BOT_SYSTEM.messages.unconfirmed.msg, ANTI_BOT_SYSTEM.messages.unconfirmed.type, ANTI_BOT_SYSTEM.config.channelId)
- ANTI_BOT_SYSTEM.cache.players[player:getId()] = nil
- if player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations) < ANTI_BOT_SYSTEM.config.notations then
- if player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations) ~= -1 then
- player:setStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations, math.max(player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations) + 1))
- else
- player:setStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations, 1)
- end
- player:teleportTo(player:getTown():getTemplePosition())
- player:sendTextMessage(ANTI_BOT_SYSTEM.messages.notation.type, string.format(ANTI_BOT_SYSTEM.messages.notation.msg, math.max(player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations))))
- else
- player:teleportTo(Position(unpack(ANTI_BOT_SYSTEM.config.prision)))
- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, ANTI_BOT_SYSTEM.messages.reason.msg)
- player:setStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations, -1)
- end
- end
- return true
- end
- function onKill(creature, target)
- local targetMonster = target:getMonster()
- local player = creature:getPlayer()
- local random = math.random(ANTI_BOT_SYSTEM.config.minMonstersToCheck, ANTI_BOT_SYSTEM.config.maxMonstersToCheck)
- if not targetMonster then
- return true
- end
- if isInArray(ANTI_BOT_SYSTEM.config.monstersForNotCheck, targetMonster:getName():lower()) then
- return true
- end
- if not ANTI_BOT_SYSTEM.cache.players[player:getId()] then
- ANTI_BOT_SYSTEM.cache.players[player:getId()] = {count = 1, verified = false}
- else
- if ANTI_BOT_SYSTEM.cache.players[player:getId()].count >= random then
- ANTI_BOT_SYSTEM.cache.players[player:getId()] = {count = math.max(ANTI_BOT_SYSTEM.cache.players[player:getId()].count), verified = true}
- player:openChannel(ANTI_BOT_SYSTEM.config.channelId)
- player:getPosition():sendMagicEffect(CONST_ME_TUTORIALSQUARE)
- else
- ANTI_BOT_SYSTEM.cache.players[player:getId()] = {count = math.max(ANTI_BOT_SYSTEM.cache.players[player:getId()].count) + 1, verified = false}
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement