Hello, I want to show you one of my job, this is fully automatic anti-bot system.
Features:
- System will check all hunting players... (every xxx minutes).
- Only check players if level is more than... (you can set level)
- Only check if the player killed monster 1 minute ago... (you can set time to check after kill the monster)
- Asks a simple question like "Please write your code...".
- Teleporting player (who is using cave bot atm, and didnt respond).
- If player has been checked by bot system 3 or more times, then start doing ban for XXX hours for all future checks on player.
- You can set a SPECIAL storage if player have it then he won't be checked (like premium features to SMS Shop).
I will add some photos within some days.
I've added a lot of comments to function.
Files:
Creaturescripts:
In XML :
Code:
<event type="kill" name="antibot" event="script" value="antibot.lua"/>
In login.lua :
Code:
registerCreatureEvent(cid, "antibot")
And make a file antibot.lua :
Code:
--[[
Anti Bot System by Potar
ver.: 1.00 (2012-12-24)
contact.: View Profile: Potar - OtLand
file.: Creaturescripts
]]--
function onKill(cid, target, lastHit)
if isPlayer(target) or isSummon(target) then return true end
AB_SYSTEM_set(cid, AB_SYSTEM_KILLSTORAGE, os.time())
return true
end
Talkactions:
In XML :
Code:
<talkaction log="yes" words="!antibot" event="script" value="antibot.lua"/>
And make a file antibot.lua :
Code:
--[[
Anti Bot System by Potar
ver.: 1.00 (2012-12-24)
contact.: View Profile: Potar - OtLand
file.: Talkaction
]]--
function onSay(cid, words, param, channel)
if AB_SYSTEM_get(cid,AB_SYSTEM_CAN_USE_TALKACTION) >= 1 then
if(param == '') then
AB_SYSTEM_send_player_white_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,AB_SYSTEM_USER_RANDOM_NUMBER)..".")
return true
end
if param == ''..AB_SYSTEM_get(cid,AB_SYSTEM_USER_RANDOM_NUMBER)..'' then
AB_SYSTEM_set(cid, AB_SYSTEM_CAN_USE_TALKACTION, 0)
AB_SYSTEM_set(cid, AB_SYSTEM_USER_RANDOM_NUMBER, 0)
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_RESPOND_WRONG, 0)
AB_SYSTEM_send_player_white_text(cid, "Thank you for the correct answer.")
else
local player = getPlayerGUIDByName(cid)
local account = getAccountIdByName(cid)
local how = AB_SYSTEM_get(cid,AB_SYSTEM_TIMES_ALREADY_CAUGHT)
local how2 = AB_SYSTEM_get(cid,AB_SYSTEM_TIMES_RESPOND_WRONG)
local how3 = how2 + 1
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_RESPOND_WRONG, how3)
local how5 = AB_SYSTEM_get(cid,AB_SYSTEM_TIMES_RESPOND_WRONG)
AB_SYSTEM_send_player_white_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,AB_SYSTEM_USER_RANDOM_NUMBER).." that was your "..how3.." time of "..AB_SYSTEM_TIMES_WRONG.." wrong answers.")
if how5 == 3 then
AB_SYSTEM_set(cid, AB_SYSTEM_CAN_USE_TALKACTION, 0)
AB_SYSTEM_set(cid, AB_SYSTEM_USER_RANDOM_NUMBER, 0)
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_RESPOND_WRONG, 0)
if how <= 0 then
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 1)
doTeleportThing(cid, AB_SYSTEM_TELEPORT_TO)
AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
elseif how == 1 then
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 2)
doTeleportThing(cid, AB_SYSTEM_TELEPORT_TO)
AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
elseif how >= 2 then
doTeleportThing(cid, AB_SYSTEM_TELEPORT_TO)
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 0)
doAddAccountBanishment(account, player, AB_SYSTEM_BAN_LENGHT * 3600 + os.time(),12, ACTION_BANISHMENT, "Anti-Bot System")
doRemoveCreature(cid)
end
end
end
else
AB_SYSTEM_send_player_white_text(cid, "The AntiBot system is not already avaiable for you.")
end
return true
end
Lib:
Make a file 177-AntiBot.lua :
Code:
--[[
Anti Bot System by Potar
ver.: 1.00 (2012-12-24)
contact.: View Profile: Potar - OtLand
file.: LIB
]]--
AB_SYSTEM_CHECK_WHEN = 60 -- seconds, after kill monster --done
AB_SYSTEM_CHECK_LVL = 200 -- lvl player to check --done
AB_SYSTEM_TIME_AFTER_TP = 90 --(If player does not respond correctly after 1.5 minutes)
AB_SYSTEM_TIMES_WRONG = 3 --(If player does not respond correctly after 3 times)
AB_SYSTEM_TELEPORT_TO = {x = 659, y = 652, z = 7}
AB_SYSTEM_BAN_LENGHT = 12 --hours time before 3 time
AB_SYSTEM_TEXT_AFTER_TP = "You have beed moved to the place of botters and you recived warning keep playing but stop botting!"
AB_SYSTEM_BASE = 77000 -- this storage must be free, from 77000 to 77006 --done
AB_SYSTEM_KILLSTORAGE = AB_SYSTEM_BASE + 1 --done
AB_SYSTEM_TIMES_RESPOND_WRONG = AB_SYSTEM_BASE + 2
AB_SYSTEM_TIMES_ALREADY_CAUGHT = AB_SYSTEM_BASE + 3
AB_SYSTEM_IGNOREUSERS = AB_SYSTEM_BASE + 4 --done
AB_SYSTEM_CAN_USE_TALKACTION = AB_SYSTEM_BASE + 5 --done
AB_SYSTEM_USER_RANDOM_NUMBER = AB_SYSTEM_BASE + 6 --done
function AB_SYSTEM_get(cid, a_storage)
return getPlayerStorageValue(cid, a_storage)
end
function AB_SYSTEM_set(cid, b_storage, b_value)
setPlayerStorageValue(cid, b_storage, b_value)
end
function AB_SYSTEM_send_player_white_text(cid, text)
doPlayerSendTextMessage(cid, 18, text)
end
function AB_SYSTEM_send_player_red_text(cid, text)
doPlayerSendTextMessage(cid, 22, text)
end
function isOnline(player)
local rows = db.getResult("SELECT `online` FROM `players` WHERE `id` = " .. player .. ";")
local on = rows:getDataInt("online")
if on ~= 0 then
return TRUE
else
return FALSE
end
end
function isSummon(cid)
return getCreatureMaster(cid) ~= nil
end
Globalevent:
In XML :
Code:
<globalevent name="antibot" interval="1800000" event="script" value="antibot.lua"/>
And make a file antibot.lua :
Code:
--[[
Anti Bot System by Potar
ver.: 1.00 (2012-12-24)
contact.: View Profile: Potar - OtLand
file.: Globalevent
Globalevent.xml : <globalevent name="antibot" interval="1800000" event="script" value="antibot.lua"/>
Interval: 1800000 = 1000 * 60 * 30 (30 minutes)
On line 26 you can exchange message to player.
On line 45, you can exchange last "1" to player ID who has banned the player, for example if your player ID is 2 just set it to 2.
]]--
function onThink(interval, lastExecution)
for _, name in ipairs(getOnlinePlayers()) do
local cid = getPlayerByName(name)
local player = getPlayerGUIDByName(name)
local account = getAccountIdByName(name)
local value1 = AB_SYSTEM_get(cid,AB_SYSTEM_KILLSTORAGE)
local value2 = AB_SYSTEM_CHECK_WHEN
local value3 = value1 + value2
if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= AB_SYSTEM_CHECK_LVL and AB_SYSTEM_get(cid,AB_SYSTEM_IGNOREUSERS) <= 0 and AB_SYSTEM_get(cid,AB_SYSTEM_CAN_USE_TALKACTION) <= 0 then
AB_SYSTEM_set(cid, AB_SYSTEM_CAN_USE_TALKACTION, 1)
AB_SYSTEM_set(cid, AB_SYSTEM_USER_RANDOM_NUMBER, math.random(10000,99999)) -- random number!
AB_SYSTEM_send_player_white_text(cid, "[Anti Bot System] You have "..AB_SYSTEM_TIME_AFTER_TP.." seconds to say: !antibot "..AB_SYSTEM_get(cid,AB_SYSTEM_USER_RANDOM_NUMBER).." or you will be teleported, but if it is your "..AB_SYSTEM_TIMES_WRONG.." time you will be bannded.")
--System
addEvent(function ()
if isOnline(player) == TRUE then
if AB_SYSTEM_get(cid,AB_SYSTEM_CAN_USE_TALKACTION) >= 1 then
local how = AB_SYSTEM_get(cid,AB_SYSTEM_TIMES_ALREADY_CAUGHT)
AB_SYSTEM_set(cid, AB_SYSTEM_CAN_USE_TALKACTION, 0)
AB_SYSTEM_set(cid, AB_SYSTEM_USER_RANDOM_NUMBER, 0)
if how <= 0 then
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 1)
doTeleportThing(cid, AB_SYSTEM_TELEPORT_TO)
AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
elseif how == 1 then
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 2)
doTeleportThing(cid, AB_SYSTEM_TELEPORT_TO)
AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
elseif how >= 2 then
doTeleportThing(cid, AB_SYSTEM_TELEPORT_TO)
AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 0)
doAddAccountBanishment(account, player, AB_SYSTEM_BAN_LENGHT * 3600 + os.time(),12, ACTION_BANISHMENT, "Anti-Bot System")
doRemoveCreature(cid)
end
end
end
end,AB_SYSTEM_TIME_AFTER_TP * 1000)
--EndSystem
end
end
return true
end
This code was sold to one member (Extrodus) but he didn't pay the total amount.
Respect my work, and if you like it just give me REPUTATION points.
Last edited: