Hello guys,
IM with some problems with one script that was made by one scripter in my old server, but i lost contact with him and now im with that prob to solve... i need help... i hv not much money but if any script want a low or mid priced jobs, contact me... below ill post the old script, help please to get that script online again.
iv to say too that, the script hv no bugs in console and just do not execute.
in creaturescript/scripts/antibot.lua
in creaturescript/creaturescript.xml
register tag in creaturescript/scripts/others/login.lua
in chatchannels/chatchannels.xml
in chatchannels/scripts/antibot.lua
THANKS TO ALL THAT GET ATTENTION IN MY POST!
IM with some problems with one script that was made by one scripter in my old server, but i lost contact with him and now im with that prob to solve... i need help... i hv not much money but if any script want a low or mid priced jobs, contact me... below ill post the old script, help please to get that script online again.
iv to say too that, the script hv no bugs in console and just do not execute.
in creaturescript/scripts/antibot.lua
Code:
ANTI_BOT_SYSTEM = {
config = {
minMonstersToCheck = 2, -- O sistema irá escolher aleatoriamente um número de monstros entre esses dois valores para verificar.
maxMonstersToCheck = 4,
channelId = 10, -- Id do channel que será aberto para realizar a verificação.
timeToAnswer = 10, -- Quanto tempo em segundos o jogador tem para responder a verificação.
monstersForNotCheck = {'rat', 'bug', 'tiger'}, -- Monstros que não serão verificados pelo sistema.
notations = 3, -- Quantas notificações o jogador pode receber antes de ser banido.
banDays = 1, -- 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).
},
questions = {
[1] = {question = 'Digite quantas letras possui a palavra: Carro', answer = '5'},
[2] = {question = 'O que significa Ying e Yang?', answer = 'bem e o mal'},
[3] = {question = 'Qual é a cor do sol?', answer = 'amarelo'},
--[numero seguinte] = {question = 'pergunta', answer = 'resposta'},
},
cache = {
players = {
--[player:getId()] = {count = 1}
},
question = 0,
},
messages = {
reason = {msg = 'Você foi banido por utilizar bot 100% AFK.'},
notation = {msg = 'Você foi penalizado e recebeu um notificação. Lembre-se que após receber 3 notificações você será banido. Você possui %d notificações no momento.', type = MESSAGE_EVENT_ADVANCE},
attention = {msg = '[Anti-Bot] Atenção! Você só possui %d segundos para responder a verificação.', type = TALKTYPE_CHANNEL_O},
channel_enter = {msg = '[Anti-Bot] Você está sobre suspeitas de uso aplicativos não autorizados.\nPor favor, confirme a verificação a seguir, você possui %d segundos para isso.', type = TALKTYPE_CHANNEL_O},
channel_close = {msg = '[Anti-Bot] Para sua segurança, não é possivel fechar este channel antes da verificação. Por favor responda o que lhe foi perguntado para que não 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] Você respondeu corretamente, obrigado e bom jogo! Você já pode fechar este channel.', type = TALKTYPE_CHANNEL_O},
unconfirmed = {msg = 'Você não realizou a verificação corretamente, por isso você foi penalizado. Este channel já 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(player:getTown():getTemplePosition())
db.query("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..getAccountNumberByPlayerName(player:getName())..", "..db.escapeString(ANTI_BOT_SYSTEM.messages.reason.msg)..", "..timeNow..", "..timeNow + (ANTI_BOT_SYSTEM.config.banDays * 86400) ..", 1)")
player:remove()
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
in creaturescript/creaturescript.xml
Code:
<event type="kill" name="AntiBot" script="antibot.lua" />
register tag in creaturescript/scripts/others/login.lua
Code:
'AntiBot',
in chatchannels/chatchannels.xml
Code:
<channel id="10" name="Anti Bot" public="1" script="antibot.lua" />
in chatchannels/scripts/antibot.lua
Code:
function onJoin(player)
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
player:popupFYI('You can\'t open this channel.')
return false
end
addEvent(function() player:sendChannelMessage("", string.format(ANTI_BOT_SYSTEM.messages.channel_enter.msg, ANTI_BOT_SYSTEM.config.timeToAnswer), ANTI_BOT_SYSTEM.messages.channel_enter.type, ANTI_BOT_SYSTEM.config.channelId) end, 300)
addEvent(function()
local random = math.random(#ANTI_BOT_SYSTEM.questions)
player:sendChannelMessage("", ANTI_BOT_SYSTEM.questions[random].question, TALKTYPE_CHANNEL_R1, ANTI_BOT_SYSTEM.config.channelId)
ANTI_BOT_SYSTEM.cache.question = random
end, 2000)
addEvent(vericationBot, ANTI_BOT_SYSTEM.config.timeToAnswer * 1000, player:getId())
return true
end
function onLeave(player)
if not player then
return true
end
if ANTI_BOT_SYSTEM.cache.players[player:getId()] then
player:openChannel(ANTI_BOT_SYSTEM.config.channelId)
addEvent(function() player:sendChannelMessage("", ANTI_BOT_SYSTEM.messages.channel_close.msg, ANTI_BOT_SYSTEM.messages.channel_close.type, ANTI_BOT_SYSTEM.config.channelId) end, 300)
end
end
function onSpeak(player, type, message)
player:sendChannelMessage(player:getName(), message, TALKTYPE_CHANNEL_Y, ANTI_BOT_SYSTEM.config.channelId)
if message ~= ANTI_BOT_SYSTEM.questions[ANTI_BOT_SYSTEM.cache.question].answer then
addEvent(function() player:sendChannelMessage("", ANTI_BOT_SYSTEM.messages.wrong_answer.msg, ANTI_BOT_SYSTEM.messages.wrong_answer.type, ANTI_BOT_SYSTEM.config.channelId) end, 300)
else
addEvent(function() player:sendChannelMessage("", ANTI_BOT_SYSTEM.messages.correct_answer.msg, ANTI_BOT_SYSTEM.messages.correct_answer.type, ANTI_BOT_SYSTEM.config.channelId) end, 300)
ANTI_BOT_SYSTEM.cache.players[player:getId()] = nil
end
return false
end
THANKS TO ALL THAT GET ATTENTION IN MY POST!