Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. --[[
  2. ## SCRIPT BY: Pedriinz ##
  3. ## CONTACT SKYPE: pedrosz4 ##
  4. ]]
  5.  
  6. ANTI_BOT_SYSTEM = {
  7. config = {
  8. minMonstersToCheck = 5, -- O sistema irá escolher aleatoriamente um número de monstros entre esses dois valores para verificar.
  9. maxMonstersToCheck = 10,
  10. channelId = 11, -- Id do channel que será aberto para realizar a verificação.
  11. timeToAnswer = 50, -- Quanto tempo em segundos o jogador tem para responder a verificação.
  12. monstersForNotCheck = {'rotworm', 'bug', 'carrion worm', 'tiger'}, -- Monstros que não serão verificados pelo sistema.
  13. notations = 50000, -- Quantas notificações o jogador pode receber antes de ser banido.
  14. banDays = 0, -- Quantidade de dias o personagem vai ficar banido por utilizar bot.
  15. storageForNotations = 1222, -- Storage onde ficará salvo as notations.
  16. storageForOpenChat = 10383, -- Storage que permitira o chat ser aberto. (Aconselho não mudar).
  17. prision = {3301,2574,7}
  18. },
  19. questions = {
  20. [1] = {question = 'Digite "to aqui"', answer = 'to aqui'},
  21. [2] = {question = 'Digite "to aqui"', answer = 'to aqui'},
  22. [3] = {question = 'Digite "to aqui"', answer = 'to aqui'},
  23. --[numero seguinte] = {question = 'pergunta', answer = 'resposta'},
  24. },
  25. cache = {
  26. players = {
  27. --[player:getId()] = {count = 1}
  28. },
  29. question = 0,
  30. },
  31. messages = {
  32. reason = {msg = 'Voce foi preso por utilizar bot 100% AFK.'},
  33. notation = {msg = 'Voce foi penalizado e recebeu um notificacao.', type = MESSAGE_EVENT_ADVANCE},
  34. attention = {msg = '[Anti-Bot] Atencao! Voce so possui %d segundos para responder a verificacao.', type = TALKTYPE_CHANNEL_O},
  35. 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},
  36. 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},
  37. wrong_answer = {msg = '[Anti-Bot] Resposta errada, por favor tente novamente.', type = TALKTYPE_CHANNEL_O},
  38. correct_answer = {msg = '[Anti-Bot] Voce respondeu corretamente, obrigado e bom jogo! Voce ja pode fechar este channel.', type = TALKTYPE_CHANNEL_O},
  39. unconfirmed = {msg = 'Voce nao realizou a verificacao corretamente, por isso voce foi penalizado. Este channel ja pode ser fechado.', type = TALKTYPE_CHANNEL_O},
  40. }
  41. }
  42.  
  43. function vericationBot(cid)
  44. local player = Player(cid)
  45. local timeNow = os.time()
  46. if not player then
  47. return true
  48. end
  49.  
  50. if not ANTI_BOT_SYSTEM.cache.players[player:getId()] or ANTI_BOT_SYSTEM.cache.players[player:getId()].verified == false then
  51. return true
  52. else
  53. player:sendChannelMessage("", ANTI_BOT_SYSTEM.messages.unconfirmed.msg, ANTI_BOT_SYSTEM.messages.unconfirmed.type, ANTI_BOT_SYSTEM.config.channelId)
  54. ANTI_BOT_SYSTEM.cache.players[player:getId()] = nil
  55. if player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations) < ANTI_BOT_SYSTEM.config.notations then
  56. if player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations) ~= -1 then
  57. player:setStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations, math.max(player:getStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations) + 1))
  58. else
  59. player:setStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations, 1)
  60. end
  61. player:teleportTo(player:getTown():getTemplePosition())
  62. 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))))
  63. else
  64. player:teleportTo(Position(unpack(ANTI_BOT_SYSTEM.config.prision)))
  65. player:sendTextMessage(MESSAGE_EVENT_ADVANCE, ANTI_BOT_SYSTEM.messages.reason.msg)
  66. player:setStorageValue(ANTI_BOT_SYSTEM.config.storageForNotations, -1)
  67. end
  68. end
  69. return true
  70. end
  71.  
  72. function onKill(creature, target)
  73. local targetMonster = target:getMonster()
  74. local player = creature:getPlayer()
  75. local random = math.random(ANTI_BOT_SYSTEM.config.minMonstersToCheck, ANTI_BOT_SYSTEM.config.maxMonstersToCheck)
  76. if not targetMonster then
  77. return true
  78. end
  79. if isInArray(ANTI_BOT_SYSTEM.config.monstersForNotCheck, targetMonster:getName():lower()) then
  80. return true
  81. end
  82. if not ANTI_BOT_SYSTEM.cache.players[player:getId()] then
  83. ANTI_BOT_SYSTEM.cache.players[player:getId()] = {count = 1, verified = false}
  84. else
  85. if ANTI_BOT_SYSTEM.cache.players[player:getId()].count >= random then
  86. ANTI_BOT_SYSTEM.cache.players[player:getId()] = {count = math.max(ANTI_BOT_SYSTEM.cache.players[player:getId()].count), verified = true}
  87. player:openChannel(ANTI_BOT_SYSTEM.config.channelId)
  88. player:getPosition():sendMagicEffect(CONST_ME_TUTORIALSQUARE)
  89. else
  90. ANTI_BOT_SYSTEM.cache.players[player:getId()] = {count = math.max(ANTI_BOT_SYSTEM.cache.players[player:getId()].count) + 1, verified = false}
  91. end
  92. end
  93.  
  94. return true
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement