• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[TFS 0.4] Anti-Bot by Potar (MOD by me)

Togu

Advanced OT User
Joined
Jun 22, 2018
Messages
308
Solutions
1
Reaction score
178
Location
Brazil
mods/antibot_system.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!-- scripts and functions by Potar -->
<!-- tested on TFS 0.4 rev 3777 (Fir3Element) -->
<!-- sends a check message to all players hunting -->
<!-- the global event is set to check every 20 minutes (1200000 miliseconds) -->
<!-- needs lib/177-AntiBot.lua (look at the end of the file) -->

<mod name="AntiBot System" version="1.0" author="" contact="OTLand" enabled="yes">

   <config name="antibot_config"><![CDATA[
       config = {
           minimumLevelToCheck = 40,
           secondsAfterKillToCheck = 60,
           secondsForPlayerAnswer = 300,
           warningsForBan = 3,
           prisonPosition = {x = 0, y = 0, z = 0},
           hoursBanished = 24,
           textAfterWarning = "You received a warning, on the 3rd you will be banished. Keep playing but stop botting!",
           storageBase = 77000,
           storageKill = 77001,
           storageNumWrongAnswers = 77002,
           storageNumWarnings = 77003,
           storageIgnoreUsers = 77004,
           storageCanUseTalkaction = 77005,
           storagePlayerRandomNumber = 77006
       }
   ]]></config>

   <event type="kill" name="antibot" event="buffer"><![CDATA[
       domodlib('antibot_config')
       if isPlayer(target) or isSummon(target) then return true end
            AB_SYSTEM_set(cid, config.storageKill, os.time())
   ]]></event>

   <event type="login" name="antibot" event="buffer"><![CDATA[
       registerCreatureEvent(cid, "antibot")
   ]]></event>

   <globalevent name="antibot" interval="1200000" event="buffer"><![CDATA[
       domodlib('antibot_config')
       local minutesToAnswer = ((config.secondsForPlayerAnswer) / 60)
       for _, name in ipairs(getOnlinePlayers()) do
           local cid = getPlayerByName(name)
           local player = getPlayerGUIDByName(name)
           local account = getAccountIdByName(name)
           local value1 = AB_SYSTEM_get(cid,config.storageKill)
           local value2 = config.secondsAfterKillToCheck
           local value3 = value1 + value2
           if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= config.minimumLevelToCheck and AB_SYSTEM_get(cid,config.storageIgnoreUsers) <= 0 and AB_SYSTEM_get(cid,config.storageCanUseTalkaction) <= 0 then
               AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 1)
               AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, math.random(10000,99999)) -- random number!
               AB_SYSTEM_send_player_white_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
               AB_SYSTEM_send_player_red_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
           --System
           addEvent(function ()
           if isOnline(player) == TRUE then
               if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
                   local how = AB_SYSTEM_get(cid,config.storageNumWarnings)
                   AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
                   AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
       
                   if  how <= 0 then
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
                       AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
                       AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
                   elseif how == 1 then
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
                       AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
                       AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
                   elseif how >= 2 then
                       doTeleportThing(cid, config.prisonPosition)
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 0)
                       doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
                       doRemoveCreature(cid)
                   end
               end
           end
           end,config.secondsForPlayerAnswer * 1000)
           --EndSystem
           end
       end
   ]]></globalevent>
 
   <talkaction log="yes" words="!antibot;/antibot" event="buffer"><![CDATA[
       domodlib('antibot_config')
       if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
           if(param == '') then
               AB_SYSTEM_send_player_red_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..".")
               AB_SYSTEM_send_player_white_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..".")
               return true
           end
           if param == ''..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..'' then
               AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
               AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
               AB_SYSTEM_set(cid, config.storageNumWrongAnswers, 0)
               AB_SYSTEM_send_player_red_text(cid, "Thank you for the correct answer.")
               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,config.storageNumWarnings)
               local how2 = AB_SYSTEM_get(cid,config.storageNumWrongAnswers)
               local how3 = how2 + 1
               AB_SYSTEM_set(cid, config.storageNumWrongAnswers, how3)
               local how5 = AB_SYSTEM_get(cid,config.storageNumWrongAnswers)
               AB_SYSTEM_send_player_red_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." that was your "..how3.." time of "..config.warningsForBan.." wrong answers.")
               AB_SYSTEM_send_player_white_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." that was your "..how3.." time of "..config.warningsForBan.." wrong answers.")
               if how5 == 3 then
                   AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
                   AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
                   AB_SYSTEM_set(cid, config.storageNumWrongAnswers, 0)
                       if  how <= 0 then
                           AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_send_player_red_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                           AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                       elseif how == 1 then
                           AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_send_player_red_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                           AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                       elseif how >= 2 then
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 0)
                           doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
                           doRemoveCreature(cid)
                       end
               end
           end
       else
       AB_SYSTEM_send_player_red_text(cid, "The AntiBot system is not already available for you.")
       AB_SYSTEM_send_player_white_text(cid, "The AntiBot system is not already available for you.")
       end
   ]]></talkaction>
</mod>

data/lib/177-AntiBot.lua
Code:
--[[
    Anti Bot System by Potar
    ver.: 1.00 (2012-12-24)
    contact.: View Profile: Potar - OtLand
    file.: LIB
]]--
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, 22, text)
end
function AB_SYSTEM_send_player_red_text(cid, text)
    doPlayerSendTextMessage(cid, 18, 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

The original script is here: Anti-Bot by Potar
GlobalEvent - [Potar] Fully automatic 100% anti-bot system (Lib/Creature/Talk/Glob).


If the player has reached X level, every X minutes there will be a global event sending him a message "Say !antibot 784659 to keep hunting or receive a warning! On the X warning you will be teleported/banished" (to make teleport work put a valid position).
 
Last edited by a moderator:
Yeah cool. Mind writing a description of how it works? What it does? Some of us don't want to read the entire script to find out.
 
seems pretty well, gonna test right now and feedback later, thanks boi
 
Code:
<!-- trains the character when clicking on a train statue -->
This comment is wrong, should be:
Code:
<!-- sends a check message to all players hunting -->

And this config line is not being used, can erase it: you just have to set to a non-valid position if you don't want teleport
Code:
teleportToPrison = false,
 
it does the job, but after banish/jail the bot doesnt work (the os.time is not downing) further the bot doesnt work after one loop
 
I confess I only tested till the character got banished. It worked well.
Didn't see if the ban time was reducing.
Didn't see if after 1 player be banished the system starts again.

The scripting/logical job was made by Potar, I only make it cleaner.
 
it does the job, but after banish/jail the bot doesnt work (the os.time is not downing) further the bot doesnt work after one l
The banish time is ok, the bug is after the banish ends, it wont send antibot request again.
 
The banish time is ok, the bug is after the banish ends, it wont send antibot request again.
I think it's easy to solve, I think it has to update some storage value of the player when he logs after the banishment. But I'm not working anymore with that TFS versions :s

Or in the moment of the banishment set this value back to normal-value. Don't know. Sorry for double reply.
 
Last edited by a moderator:
gonna test and let yo know ;)
Or in the moment of the banishment set this value back to normal-value. Don't know. Sorry for double reply.

another bug found:
if player gets message and logout the antibot system stop working until player complete the trial, this can be used to avoid the system.
 
Last edited by a moderator:
here is the patched version
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<!-- scripts and functions by Potar -->
<!-- tested on TFS 0.4 rev 3777 (Fir3Element) -->
<!-- the global event is set to check every 20 minutes (1200000 miliseconds) -->
<!-- needs lib/177-AntiBot.lua (look at the end of the file) -->
<mod name="AntiBot System" version="1.0" author="" contact="OTLand" enabled="yes">
   <config name="antibot_config"><![CDATA[
       config = {
           minimumLevelToCheck = 15,
           secondsAfterKillToCheck = 60,
           secondsForPlayerAnswer = 300,
           warningsForBan = 3,
           teleportToPrison = true,
           prisonPosition = {x = 370, y = 323, z = 5},
           hoursBanished = 1,
           textAfterWarning = "You received a warning, on the 3rd you will be banished. Keep playing but stop botting!",
           storageBase = 77000,
           storageKill = 77001,
           storageNumWrongAnswers = 77002,
           storageNumWarnings = 77003,
           storageIgnoreUsers = 77004,
           storageCanUseTalkaction = 77005,
           storagePlayerRandomNumber = 77006
       }
   ]]></config>
   <event type="kill" name="antibot" event="buffer"><![CDATA[
       domodlib('antibot_config')
       if isPlayer(target) or isSummon(target) then return true end
            AB_SYSTEM_set(cid, config.storageKill, os.time())
            addEvent(AB_SYSTEM_set, cid, config.storageKill, -1, 1*15*1000)
   ]]></event>
   <event type="login" name="antibot" event="buffer"><![CDATA[
       registerCreatureEvent(cid, "antibot")
       setPlayerStorageValue(cid, 77001, -1)
       setPlayerStorageValue(cid, 77005, -1)
       setPlayerStorageValue(cid, 77006, -1)
   ]]></event>
   <globalevent name="antibot" interval="10000" event="buffer"><![CDATA[
       domodlib('antibot_config')
       local minutesToAnswer = ((config.secondsForPlayerAnswer) / 60)
       for _, name in ipairs(getOnlinePlayers()) do
           local cid = getPlayerByName(name)
           local player = getPlayerGUIDByName(name)
           local account = getAccountIdByName(name)
           local value1 = AB_SYSTEM_get(cid,config.storageKill)
           local value2 = config.secondsAfterKillToCheck
           local value3 = value1 + value2
           if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= config.minimumLevelToCheck and AB_SYSTEM_get(cid,config.storageIgnoreUsers) <= 0 and AB_SYSTEM_get(cid,config.storageCanUseTalkaction) <= 0 then
               AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 1)
               AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, math.random(10000,99999)) -- random number!
               AB_SYSTEM_send_player_white_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
               AB_SYSTEM_send_player_red_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
           --System
           addEvent(function ()
           if isOnline(player) == TRUE then
               if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
                   local how = AB_SYSTEM_get(cid,config.storageNumWarnings)
                   AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
                   AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
       
                   if  how <= 0 then
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
                       AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
                       AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
                       setPlayerStorageValue(cid, 77001, -1)
                       setPlayerStorageValue(cid, 77005, -1)
                       setPlayerStorageValue(cid, 77006, -1)
                   elseif how == 1 then
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
                       doTeleportThing(cid,teleportToPrison)
                       AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
                       AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
                       setPlayerStorageValue(cid, 77001, -1)
                       setPlayerStorageValue(cid, 77005, -1)
                       setPlayerStorageValue(cid, 77006, -1)
                   elseif how >= 2 then
                       doTeleportThing(cid, config.prisonPosition)
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 0)
                       doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
                       doRemoveCreature(cid)
                       setPlayerStorageValue(cid, 77001, -1)
                       setPlayerStorageValue(cid, 77005, -1)
                       setPlayerStorageValue(cid, 77006, -1)                       
                   end
               end
           end
           end,config.secondsForPlayerAnswer * 1000)
           --EndSystem
           end
       end
   ]]></globalevent>
   <talkaction log="yes" words="!antibot;/antibot" event="buffer"><![CDATA[
       domodlib('antibot_config')
       if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
           if(param == '') then
               AB_SYSTEM_send_player_red_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..".")
               AB_SYSTEM_send_player_white_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..".")
               return true
           end
           if param == ''..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..'' then
               AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
               AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
               AB_SYSTEM_set(cid, config.storageNumWrongAnswers, 0)
               AB_SYSTEM_send_player_red_text(cid, "Thank you for the correct answer.")
               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,config.storageNumWarnings)
               local how2 = AB_SYSTEM_get(cid,config.storageNumWrongAnswers)
               local how3 = how2 + 1
               AB_SYSTEM_set(cid, config.storageNumWrongAnswers, how3)
               local how5 = AB_SYSTEM_get(cid,config.storageNumWrongAnswers)
               AB_SYSTEM_send_player_red_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." that was your "..how3.." time of "..config.warningsForBan.." wrong answers.")
               AB_SYSTEM_send_player_white_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." that was your "..how3.." time of "..config.warningsForBan.." wrong answers.")
               if how5 == 3 then
                   AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
                   AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
                   AB_SYSTEM_set(cid, config.storageNumWrongAnswers, 0)
                       if  how <= 0 then
                           AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_send_player_red_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                           AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                       elseif how == 1 then
                           AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
                           doTeleportThing(cid, config.prisonPosition)
                           doTeleportThing(cid,teleportToPrison)
                           AB_SYSTEM_send_player_red_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                           AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                       elseif how >= 2 then
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 0)
                           doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
                           doRemoveCreature(cid)
                       end
               end
           end
       else
       AB_SYSTEM_send_player_red_text(cid, "The AntiBot system is not already available for you.")
       AB_SYSTEM_send_player_white_text(cid, "The AntiBot system is not already available for you.")
       end
   ]]></talkaction>
</mod>
 
Why not just posting it here or in a separated thread? What is the purpose of their PMs to you?
 
here is the patched version
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<!-- scripts and functions by Potar -->
<!-- tested on TFS 0.4 rev 3777 (Fir3Element) -->
<!-- the global event is set to check every 20 minutes (1200000 miliseconds) -->
<!-- needs lib/177-AntiBot.lua (look at the end of the file) -->
<mod name="AntiBot System" version="1.0" author="" contact="OTLand" enabled="yes">
   <config name="antibot_config"><![CDATA[
       config = {
           minimumLevelToCheck = 15,
           secondsAfterKillToCheck = 60,
           secondsForPlayerAnswer = 300,
           warningsForBan = 3,
           teleportToPrison = true,
           prisonPosition = {x = 370, y = 323, z = 5},
           hoursBanished = 1,
           textAfterWarning = "You received a warning, on the 3rd you will be banished. Keep playing but stop botting!",
           storageBase = 77000,
           storageKill = 77001,
           storageNumWrongAnswers = 77002,
           storageNumWarnings = 77003,
           storageIgnoreUsers = 77004,
           storageCanUseTalkaction = 77005,
           storagePlayerRandomNumber = 77006
       }
   ]]></config>
   <event type="kill" name="antibot" event="buffer"><![CDATA[
       domodlib('antibot_config')
       if isPlayer(target) or isSummon(target) then return true end
            AB_SYSTEM_set(cid, config.storageKill, os.time())
            addEvent(AB_SYSTEM_set, cid, config.storageKill, -1, 1*15*1000)
   ]]></event>
   <event type="login" name="antibot" event="buffer"><![CDATA[
       registerCreatureEvent(cid, "antibot")
       setPlayerStorageValue(cid, 77001, -1)
       setPlayerStorageValue(cid, 77005, -1)
       setPlayerStorageValue(cid, 77006, -1)
   ]]></event>
   <globalevent name="antibot" interval="10000" event="buffer"><![CDATA[
       domodlib('antibot_config')
       local minutesToAnswer = ((config.secondsForPlayerAnswer) / 60)
       for _, name in ipairs(getOnlinePlayers()) do
           local cid = getPlayerByName(name)
           local player = getPlayerGUIDByName(name)
           local account = getAccountIdByName(name)
           local value1 = AB_SYSTEM_get(cid,config.storageKill)
           local value2 = config.secondsAfterKillToCheck
           local value3 = value1 + value2
           if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= config.minimumLevelToCheck and AB_SYSTEM_get(cid,config.storageIgnoreUsers) <= 0 and AB_SYSTEM_get(cid,config.storageCanUseTalkaction) <= 0 then
               AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 1)
               AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, math.random(10000,99999)) -- random number!
               AB_SYSTEM_send_player_white_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
               AB_SYSTEM_send_player_red_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
           --System
           addEvent(function ()
           if isOnline(player) == TRUE then
               if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
                   local how = AB_SYSTEM_get(cid,config.storageNumWarnings)
                   AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
                   AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
     
                   if  how <= 0 then
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
                       AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
                       AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
                       setPlayerStorageValue(cid, 77001, -1)
                       setPlayerStorageValue(cid, 77005, -1)
                       setPlayerStorageValue(cid, 77006, -1)
                   elseif how == 1 then
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
                       doTeleportThing(cid,teleportToPrison)
                       AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
                       AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
                       setPlayerStorageValue(cid, 77001, -1)
                       setPlayerStorageValue(cid, 77005, -1)
                       setPlayerStorageValue(cid, 77006, -1)
                   elseif how >= 2 then
                       doTeleportThing(cid, config.prisonPosition)
                       AB_SYSTEM_set(cid, config.storageNumWarnings, 0)
                       doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
                       doRemoveCreature(cid)
                       setPlayerStorageValue(cid, 77001, -1)
                       setPlayerStorageValue(cid, 77005, -1)
                       setPlayerStorageValue(cid, 77006, -1)                     
                   end
               end
           end
           end,config.secondsForPlayerAnswer * 1000)
           --EndSystem
           end
       end
   ]]></globalevent>
   <talkaction log="yes" words="!antibot;/antibot" event="buffer"><![CDATA[
       domodlib('antibot_config')
       if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
           if(param == '') then
               AB_SYSTEM_send_player_red_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..".")
               AB_SYSTEM_send_player_white_text(cid, "Invalid param, just say !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..".")
               return true
           end
           if param == ''..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber)..'' then
               AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
               AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
               AB_SYSTEM_set(cid, config.storageNumWrongAnswers, 0)
               AB_SYSTEM_send_player_red_text(cid, "Thank you for the correct answer.")
               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,config.storageNumWarnings)
               local how2 = AB_SYSTEM_get(cid,config.storageNumWrongAnswers)
               local how3 = how2 + 1
               AB_SYSTEM_set(cid, config.storageNumWrongAnswers, how3)
               local how5 = AB_SYSTEM_get(cid,config.storageNumWrongAnswers)
               AB_SYSTEM_send_player_red_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." that was your "..how3.." time of "..config.warningsForBan.." wrong answers.")
               AB_SYSTEM_send_player_white_text(cid, "Wrong secure code, your secure code is "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." that was your "..how3.." time of "..config.warningsForBan.." wrong answers.")
               if how5 == 3 then
                   AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
                   AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
                   AB_SYSTEM_set(cid, config.storageNumWrongAnswers, 0)
                       if  how <= 0 then
                           AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_send_player_red_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                           AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                       elseif how == 1 then
                           AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
                           doTeleportThing(cid, config.prisonPosition)
                           doTeleportThing(cid,teleportToPrison)
                           AB_SYSTEM_send_player_red_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                           AB_SYSTEM_send_player_white_text(cid, AB_SYSTEM_TEXT_AFTER_TP)
                       elseif how >= 2 then
                           doTeleportThing(cid, config.prisonPosition)
                           AB_SYSTEM_set(cid, AB_SYSTEM_TIMES_ALREADY_CAUGHT, 0)
                           doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
                           doRemoveCreature(cid)
                       end
               end
           end
       else
       AB_SYSTEM_send_player_red_text(cid, "The AntiBot system is not already available for you.")
       AB_SYSTEM_send_player_white_text(cid, "The AntiBot system is not already available for you.")
       end
   ]]></talkaction>
</mod>
Sorry for bump, I am using tfs 0.3.7 rev 5969 ..

When a player get the bot check message and logout then login this error ( when mins to answer get passed ) appear in the console


Code:
[22:9:04.798] [Error - GlobalEvent Interface]
[22:9:04.806] In a timer event called from:
[22:9:04.811] local interval = 180000
[22:9:04.815] domodlib('antibot_config')
[22:9:04.820]        local minutesToAnswer = ((config.secondsForPlayerAnswer) / 60)
[22:9:04.831]        for _, name in ipairs(getOnlinePlayers()) do
[22:9:04.840]            local cid = getPlayerByName(name)
[22:9:04.847]            local player = getPlayerGUIDByName(name)
[22:9:04.855]            local account = getAccountIdByName(name)
[22:9:04.864]            local value1 = AB_SYSTEM_get(cid,config.storageKill)
[22:9:04.875]            local value2 = config.secondsAfterKillToCheck
[22:9:04.880]            local value3 = value1 + value2
[22:9:04.887]            if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= config.minimumLevelToCheck and AB_SYSTEM_get(cid,config.storageIgnoreUsers) <= 0 and AB_SYSTEM_get(cid,config.storageCanUseTalkaction) <= 0 then
[22:9:04.916]                AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 1)
[22:9:04.924]                AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, math.random(10000,99999)) -- random number!
[22:9:04.938]                AB_SYSTEM_send_player_white_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
[22:9:04.972]                AB_SYSTEM_send_player_red_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
[22:9:05.005]            --System
[22:9:05.012]            addEvent(function ()
[22:9:05.018]            if isOnline(player) == TRUE then
[22:9:05.024]                if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
[22:9:05.033]                    local how = AB_SYSTEM_get(cid,config.storageNumWarnings)
[22:9:05.042]                    AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
[22:9:05.051]                    AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
[22:9:05.064]
[22:9:05.067]                    if  how <= 0 then
[22:9:05.077]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
[22:9:05.086]                        AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
[22:9:05.096]                        AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
[22:9:05.105]                        setPlayerStorageValue(cid, 77001, -1)
[22:9:05.115]                        setPlayerStorageValue(cid, 77005, -1)
[22:9:05.121]                        setPlayerStorageValue(cid, 77006, -1)
[22:9:05.132]                    elseif how == 1 then
[22:9:05.137]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
[22:9:05.146]                        doTeleportThing(cid,teleportToPrison)
[22:9:05.153]                        AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
[22:9:05.162]                        AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
[22:9:05.171]                        setPlayerStorageValue(cid, 77001, -1)
[22:9:05.182]                        setPlayerStorageValue(cid, 77005, -1)
[22:9:05.188]                        setPlayerStorageValue(cid, 77006, -1)
[22:9:05.201]                    elseif how >= 2 then
[22:9:05.209]                        doTeleportThing(cid, config.prisonPosition)
[22:9:05.218]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 0)
[22:9:05.224]                        doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
[22:9:05.239]                        doRemoveCreature(cid)
[22:9:05.252]                        setPlayerStorageValue(cid, 77001, -1)
[22:9:05.261]                        setPlayerStorageValue(cid, 77005, -1)
[22:9:05.268]                        setPlayerStorageValue(cid, 77006, -1)
[22:9:05.278]                    end
[22:9:05.282]                end
[22:9:05.287]            end
[22:9:05.294]            end,config.secondsForPlayerAnswer * 1000)
[22:9:05.300]            --EndSystem
[22:9:05.304]            end
[22:9:05.309]        end
[22:9:05.317]
[22:9:05.319] Description:
[22:9:05.329] (LuaInterface::luaDoCreatureSetStorage) Creature not found

and another error when a player get 1st warning and in 2nd one this error comes ( also after mins to answer pass )

Code:
[22:18:03.563] [Error - GlobalEvent Interface]
[22:18:03.569] In a timer event called from:
[22:18:03.575] local interval = 180000
[22:18:03.585] domodlib('antibot_config')
[22:18:03.589]        local minutesToAnswer = ((config.secondsForPlayerAnswer) / 60)
[22:18:03.600]        for _, name in ipairs(getOnlinePlayers()) do
[22:18:03.607]            local cid = getPlayerByName(name)
[22:18:03.616]            local player = getPlayerGUIDByName(name)
[22:18:03.623]            local account = getAccountIdByName(name)
[22:18:03.633]            local value1 = AB_SYSTEM_get(cid,config.storageKill)
[22:18:03.639]            local value2 = config.secondsAfterKillToCheck
[22:18:03.647]            local value3 = value1 + value2
[22:18:03.654]            if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= config.minimumLevelToCheck and AB_SYSTEM_get(cid,config.storageIgnoreUsers) <= 0 and AB_SYSTEM_get(cid,config.storageCanUseTalkaction) <= 0 then
[22:18:03.676]                AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 1)
[22:18:03.684]                AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, math.random(10000,99999)) -- random number!
[22:18:03.697]                AB_SYSTEM_send_player_white_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
[22:18:03.731]                AB_SYSTEM_send_player_red_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
[22:18:03.765]            --System
[22:18:03.769]            addEvent(function ()
[22:18:03.775]            if isOnline(player) == TRUE then
[22:18:03.782]                if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
[22:18:03.791]                    local how = AB_SYSTEM_get(cid,config.storageNumWarnings)
[22:18:03.800]                    AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
[22:18:03.809]                    AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
[22:18:03.818]
[22:18:03.822]                    if  how <= 0 then
[22:18:03.831]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
[22:18:03.839]                        AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
[22:18:03.856]                        AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
[22:18:03.868]                        setPlayerStorageValue(cid, 77001, -1)
[22:18:03.876]                        setPlayerStorageValue(cid, 77005, -1)
[22:18:03.884]                        setPlayerStorageValue(cid, 77006, -1)
[22:18:03.892]                    elseif how == 1 then
[22:18:03.899]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
[22:18:03.908]                        doTeleportThing(cid,teleportToPrison)
[22:18:03.914]                        AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
[22:18:03.924]                        AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
[22:18:03.937]                        setPlayerStorageValue(cid, 77001, -1)
[22:18:03.943]                        setPlayerStorageValue(cid, 77005, -1)
[22:18:03.953]                        setPlayerStorageValue(cid, 77006, -1)
[22:18:03.961]                    elseif how >= 2 then
[22:18:03.968]                        doTeleportThing(cid, config.prisonPosition)
[22:18:03.974]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 0)
[22:18:03.984]                        doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
[22:18:04.000]                        doRemoveCreature(cid)
[22:18:04.006]                        setPlayerStorageValue(cid, 77001, -1)
[22:18:04.016]                        setPlayerStorageValue(cid, 77005, -1)
[22:18:04.024]                        setPlayerStorageValue(cid, 77006, -1)
[22:18:04.032]                    end
[22:18:04.038]                end
[22:18:04.046]            end
[22:18:04.050]            end,config.secondsForPlayerAnswer * 1000)
[22:18:04.059]            --EndSystem
[22:18:04.065]            end
[22:18:04.068]        end
[22:18:04.072]
[22:18:04.076] Description:
[22:18:04.078] attempt to index a nil value
[22:18:04.085] stack traceback:
[22:18:04.089]  [C]: in function 'doTeleportThing'
[22:18:04.096]  [string "LuaInterface::loadBuffer"]:33: in function <[string "LuaInterface::loadBuffer"]:17>

Code:
[22:24:04.077] [Error - GlobalEvent Interface]
[22:24:04.088] In a timer event called from:
[22:24:04.094] local interval = 180000
[22:24:04.098] domodlib('antibot_config')
[22:24:04.104]        local minutesToAnswer = ((config.secondsForPlayerAnswer) / 60)
[22:24:04.113]        for _, name in ipairs(getOnlinePlayers()) do
[22:24:04.120]            local cid = getPlayerByName(name)
[22:24:04.127]            local player = getPlayerGUIDByName(name)
[22:24:04.134]            local account = getAccountIdByName(name)
[22:24:04.145]            local value1 = AB_SYSTEM_get(cid,config.storageKill)
[22:24:04.153]            local value2 = config.secondsAfterKillToCheck
[22:24:04.159]            local value3 = value1 + value2
[22:24:04.166]            if isPlayer(cid) and value3 >= os.time() and getPlayerLevel(cid) >= config.minimumLevelToCheck and AB_SYSTEM_get(cid,config.storageIgnoreUsers) <= 0 and AB_SYSTEM_get(cid,config.storageCanUseTalkaction) <= 0 then
[22:24:04.187]                AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 1)
[22:24:04.197]                AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, math.random(10000,99999)) -- random number!
[22:24:04.210]                AB_SYSTEM_send_player_white_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
[22:24:04.241]                AB_SYSTEM_send_player_red_text(cid, "You have "..minutesToAnswer.." minutes to say: !antibot "..AB_SYSTEM_get(cid,config.storagePlayerRandomNumber).." or you will receive a warning, but if it is your "..config.warningsForBan.."rd warning you will be banished.")
[22:24:04.271]            --System
[22:24:04.274]            addEvent(function ()
[22:24:04.281]            if isOnline(player) == TRUE then
[22:24:04.286]                if AB_SYSTEM_get(cid,config.storageCanUseTalkaction) >= 1 then
[22:24:04.295]                    local how = AB_SYSTEM_get(cid,config.storageNumWarnings)
[22:24:04.304]                    AB_SYSTEM_set(cid, config.storageCanUseTalkaction, 0)
[22:24:04.313]                    AB_SYSTEM_set(cid, config.storagePlayerRandomNumber, 0)
[22:24:04.319]
[22:24:04.323]                    if  how <= 0 then
[22:24:04.327]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 1)
[22:24:04.337]                        AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
[22:24:04.347]                        AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
[22:24:04.357]                        setPlayerStorageValue(cid, 77001, -1)
[22:24:04.364]                        setPlayerStorageValue(cid, 77005, -1)
[22:24:04.376]                        setPlayerStorageValue(cid, 77006, -1)
[22:24:04.387]                    elseif how == 1 then
[22:24:04.391]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 2)
[22:24:04.398]                        doTeleportThing(cid,teleportToPrison)
[22:24:04.408]                        AB_SYSTEM_send_player_red_text(cid, config.textAfterWarning)
[22:24:04.418]                        AB_SYSTEM_send_player_white_text(cid, config.textAfterWarning)
[22:24:04.432]                        setPlayerStorageValue(cid, 77001, -1)
[22:24:04.442]                        setPlayerStorageValue(cid, 77005, -1)
[22:24:04.451]                        setPlayerStorageValue(cid, 77006, -1)
[22:24:04.460]                    elseif how >= 2 then
[22:24:04.470]                        doTeleportThing(cid, config.prisonPosition)
[22:24:04.478]                        AB_SYSTEM_set(cid, config.storageNumWarnings, 0)
[22:24:04.490]                        doAddAccountBanishment(account, player, config.hoursBanished * 3600 + os.time(),12, ACTION_BANISHMENT, "Cavebotting")
[22:24:04.507]                        doRemoveCreature(cid)
[22:24:04.512]                        setPlayerStorageValue(cid, 77001, -1)
[22:24:04.519]                        setPlayerStorageValue(cid, 77005, -1)
[22:24:04.526]                        setPlayerStorageValue(cid, 77006, -1)
[22:24:04.534]                    end
[22:24:04.538]                end
[22:24:04.542]            end
[22:24:04.547]            end,config.secondsForPlayerAnswer * 1000)
[22:24:04.553]            --EndSystem
[22:24:04.558]            end
[22:24:04.561]        end
[22:24:04.569]
[22:24:04.571] Description:
[22:24:04.576] [string "LuaInterface::loadBuffer"]:19: attempt to compare number with boolean
[22:24:04.583] stack traceback:
[22:24:04.587]  [string "LuaInterface::loadBuffer"]:19: in function <[string "LuaInterface::loadBuffer"]:17>

Any help ?
 
Last edited:
It's perfect, but how can I make it not detect it when the characters are in the trainers? since if they are afk they will all end up banned
 
It's perfect, but how can I make it not detect it when the characters are in the trainers? since if they are afk they will all end up banned
make unique id when on step into training floor or use door and onstepouit teleport then make script check for that storage
 
Perfect, I tried it and no problem. But how can I make the warning appear above the person? with red letters
 
Check your luascript.cpp for functions
It's doplayersendtextmessage or something similar
 

Similar threads

Back
Top