Dankoo
Active Member
- Joined
- Sep 4, 2010
- Messages
- 1,007
- Reaction score
- 27
Ya, this is a hard request, I have this script (made by Cykotitan)
http://otland.net/f132/lua-anti-cav...-paying-10-usd-121267/index2.html#post1187983
The idea: The original script teleports player to the jail if player didn't answer the questions,
My script simply set MySQL column `botter` to 1, and working with other scripts, everyone knows that player is a botter...
What I've tried to change from the original script:
● Removed check at login
● Removed prison, added storage for botter + alter column botter in MySQL
● Removed check if player is afk (!afk on = storage 38417)
● Removed check if player is already a botter
● Added check at attack monster (don't check if attack player)
Problems:
● Script isn't activating when attack monster
What I want to do but don't know how:
● When player is tagged as botter, it will be for one month, then it clears
● When player is tagged as botter, it records in sql, just for website purposes, like "Tagged as botter in 23/march/2011 until 23/april/2011"
http://otland.net/f132/lua-anti-cav...-paying-10-usd-121267/index2.html#post1187983
The idea: The original script teleports player to the jail if player didn't answer the questions,
My script simply set MySQL column `botter` to 1, and working with other scripts, everyone knows that player is a botter...
LUA:
local time = {22, 08}
local mintoanswer = 5 -- minutes to answer anti bot system
local delayAntiBot = 60 -- minutes of delay of delayAntiBot
local maxgroupid = 1 -- groupid higher than this don't have antiBotSystem Activated
local botter = 15850 -- storageID for botter
local storages = {first_num = 3, second_num = 4, result = 5, answer = 6, prisoned = 7, prisontime = 8, wrong_answers = 9}
prisonEvent, antiBotEvent, checkAnswerEvent = {}, {}, {}
local function checkprisoned(cid)
if getCreatureStorage(cid, storages.prisoned) == 1 then
if os.time() >= getCreatureStorage(cid, storages.prisontime) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You had completed your time here in the prison! You may now relog to go to the city.')
else
prisonEvent[cid] = addEvent(checkprisoned, 1000, cid)
end
end
end
local function checkAnswer(cid)
local wrong = getCreatureStorage(cid, storages.wrong_answers)
if wrong > 5 or (getCreatureStorage(cid, storages.answer) ~= 1 and getCreatureStorage(cid, storages.prisoned) ~= 1 and getCreatureStorage(cid, storages.result) ~= -1) then
doCreatureSetStorage(cid, botter, 1)
db.query('UPDATE players SET botter=1 WHERE id='..getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, wrong > 5 and 'Time limit! You have been tagged as BOTTER because you answered wrong too many times.' or 'Time limit! You had been tagged as BOTTER.')
else
doCreatureSetStorage(cid, storages.prisoned)
end
doCreatureSetStorage(cid, storages.first_num)
doCreatureSetStorage(cid, storages.second_num)
doCreatureSetStorage(cid, storages.result)
doCreatureSetStorage(cid, storages.answer)
doCreatureSetStorage(cid, storages.wrong_answers)
end
local function append(l)
local s = ''
for i = 1, math.random(l) do
s = s .. string.char(math.random(2) == 1 and math.random(65, 90) or math.random(97, 122))
end
return s
end
local function antiBot(cid)
if getCreatureStorage(cid, botter) == -1 and getCreatureStorage(cid, 38417) == -1 then
local r, first, second = math.random(3), math.random(9), math.random(9)
r = r==1 and '+' or r==2 and '*' or '-'
local s = append(2) .. first .. append(4) .. r .. append(2) .. second .. append(4)
doCreatureSetStorage(cid, storages.first_num, first)
doCreatureSetStorage(cid, storages.second_num, second)
doCreatureSetStorage(cid, storages.result, math.ceil(loadstring('return '..first..r..second)()))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Anti Bot System: You have '.. mintoanswer ..' minutes to answer how much is '.. s ..'. (Desconsider the letters) To answer say: !antibot number (In case you want to be AFK or train skills, use !afk on)')
doPlayerSendTextMessage(cid, 22, 'Anti Bot System: Example: P8VM-O2W, desconsidering the letters it is 8-2, wich is 6, then you would say !antibot 6 ... Where* multiply / divide - subtract + sum')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Anti Bot System: Você tem '.. mintoanswer ..' minutos para responder quanto é '.. s ..'. (Desconsidere as letras) Para responder digite: !antibot número (Caso deseje treinar skill ou ficar afk utilize !afk on)')
doPlayerSendTextMessage(cid, 22, 'Anti Bot System: Exemplo: P8VM-O2W, desconsiderando as letras dá 8-2, que é igual a 6, então você deve responder !antibot 6 ... Sendo * multiplicar / dividir - subtrair + somar')
checkAnswerEvent[cid] = addEvent(checkAnswer, mintoanswer*60*1000, cid)
end
antiBotEvent[cid] = addEvent(antiBot, delayAntiBot*60*1000, cid)
end
function onAttack(cid, target)
local n = tonumber(os.date('%H'))
if (n >= time[1] or n < time[2]) and getPlayerGroupId(cid) <= maxgroupid then
if not isPlayer(target) then
if getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE and getCreatureStorage(cid, 38417) == -1 then
antiBotEvent[cid] = addEvent(antiBot, 1000, cid)
end
end
end
return true
end
function onLogin(cid)
registerCreatureEvent(cid, 'Logout')
if getCreatureStorage(cid, storages.prisoned) == 1 then
if os.time() >= getCreatureStorage(cid, storages.prisontime) then
doCreatureSetStorage(cid, storages.prisontime)
doCreatureSetStorage(cid, storages.prisoned)
doTeleportThing(cid, templepos)
else
prisonEvent[cid] = addEvent(checkprisoned, 1000, cid)
doTeleportThing(cid, prisonpos)
end
end
return true
end
function onLogout(cid)
if prisonEvent[cid] then
stopEvent(prisonEvent[cid])
prisonEvent[cid] = nil
end
if antiBotEvent[cid] then
stopEvent(antiBotEvent[cid])
antiBotEvent[cid] = nil
end
if checkAnswerEvent[cid] then
stopEvent(checkAnswerEvent[cid])
checkAnswerEvent[cid] = nil
end
doCreatureSetStorage(cid, storages.first_num)
doCreatureSetStorage(cid, storages.second_num)
doCreatureSetStorage(cid, storages.result)
doCreatureSetStorage(cid, storages.answer)
doCreatureSetStorage(cid, storages.wrong_answers)
return true
end
LUA:
<event type="attack" name="Check_Bot" script="bot_check.lua"/>
What I've tried to change from the original script:
● Removed check at login
● Removed prison, added storage for botter + alter column botter in MySQL
● Removed check if player is afk (!afk on = storage 38417)
● Removed check if player is already a botter
● Added check at attack monster (don't check if attack player)
Problems:
● Script isn't activating when attack monster
What I want to do but don't know how:
● When player is tagged as botter, it will be for one month, then it clears
● When player is tagged as botter, it records in sql, just for website purposes, like "Tagged as botter in 23/march/2011 until 23/april/2011"