• 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!

Botshield

gurden

i need support for my server, good scripter!
Joined
May 19, 2009
Messages
519
Reaction score
5
Location
Sweden
The mod called Botshield i need help could anyone fix it so it works good without errors? Code is
Code:
  <?xml version="1.0" encoding="UTF-8"?>
<mod name="BotShield" version="3.1" author="Syntax" contact="[email protected]" enabled="yes">
        <description>
        This mod will enable mid-level bot prevention in your server.
    </description>
        <channel id="13" active="no" name="BotShield"/>
        <config name="botshield_config"><![CDATA[
                config = {
                botonstorage = 56456,
        channel = 13, -- what channel is BotShield on. (Make sure matches line 7 above)
        accepted = "Accepted.", --what channel says when player passes test
        correctish = "Correct, too many attempts though, you may relog to prevent punishment if you aren't AFK.", --message if correct after too many tries
                mintoanswer = 15, -- minutes to answer anti bot system....needs to be lower than delayAntiBot
                delayAntiBot = 60, -- minutes of delay of delayAntiBot....needs to be higher than mintoanswer
                toomany = "NOTICE: Failed! Too many attempts.", --failed too many attempts message
                timedout = "NOTICE: Failed! Time limit has been reached.", --failed time limit message
                failedmsg = "                               BotShield Alert!\n      You received a notation for suspicious behavior.\n If you have complaints please report on our forum.",
                storages = {first_num = 20123, second_num = 20124, result = 20125, answer = 20126, wrong_answers = 20129}
                }
 ]]></config>
        <talkaction words="2;3;4;5;6;7;8;9;10" event="buffer"><![CDATA[
        domodlib('botshield_config')
                if (answer ~= 1 and result > 0) then
            doPlayerSendToChannel(cid, cid, 7, words, config.channel, time)
                if (words == result) then
                    if (getPlayerStorageValue(cid,config.storages.wrong_answers) <= 3) then
                        doPlayerSendToChannel(cid, cid, 15, config.accepted, config.channel, time)
                        setPlayerStorageValue(cid,config.storages.wrong_answers,0)
                        setPlayerStorageValue(cid,config.storages.answer,1)
                        setPlayerStorageValue(cid,config.storages.first_num,0)
                        setPlayerStorageValue(cid,config.storages.second_num,0)
                        setPlayerStorageValue(cid,config.storages.result,0)
                                        else
                                                doPlayerSendToChannel(cid, cid, 8, config.correctish, config.channel, time)
                    end
                else
                    wrong_answers_now = getPlayerStorageValue(cid,config.storages.wrong_answers)
                    setPlayerStorageValue(cid,config.storages.wrong_answers,wrong_answers_now+1)
                    doPlayerSendToChannel(cid, cid, 8, "Incorrect. ".. getPlayerStorageValue(cid,config.storages.wrong_answers).."/3 failed attempts.", config.channel, time)
                end
        end
]]></talkaction>
        <event type="joinchannel" name="AntiBotJoin" event="buffer"><![CDATA[
    domodlib('botshield_config')
                if(channelId == config.channel) then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "BotShield = ON")
                        doSendAnimatedText(getCreaturePosition(cid), "+stamina", 210)
                        setPlayerStamina(cid, 999999)
                        setPlayerStorageValue(cid,config.botonstorage,1)
        _result = true
    end

        function checkAnswer(parameters)
                local cid = parameters.cid
                        if (wrong_answers > 3) then
                setPlayerStorageValue(cid,config.storages.wrong_answers,0)
                setPlayerStorageValue(cid,config.storages.first_num,0)
                setPlayerStorageValue(cid,config.storages.second_num,0)
                setPlayerStorageValue(cid,config.storages.result,0)
                setPlayerStorageValue(cid,config.storages.answer,0)
                doAddNotation(getPlayerAccountId(cid), 3, 4, BotShield, auto)
                doPlayerSendToChannel(cid, cid, 17, config.toomany, config.channel, time)
                doPlayerPopupFYI(cid, config.failedmsg)
            elseif (answer ~= 1 and result > 0) then
                setPlayerStorageValue(cid,config.storages.first_num,0)
                setPlayerStorageValue(cid,config.storages.second_num,0)
                setPlayerStorageValue(cid,config.storages.result,0)
                setPlayerStorageValue(cid,config.storages.answer,0)
                setPlayerStorageValue(cid,config.storages.wrong_answers,0)
                doPlayerSendToChannel(cid, cid, 17, config.timedout, config.channel, time)
                doAddNotation(getPlayerAccountId(cid), 3, 4, "BotShield", auto)
                doPlayerPopupFYI(cid, config.failedmsg)
            else
                setPlayerStorageValue(cid,config.storages.first_num,0)
                setPlayerStorageValue(cid,config.storages.second_num,0)
                setPlayerStorageValue(cid,config.storages.result,0)
                setPlayerStorageValue(cid,config.storages.answer,0)
                setPlayerStorageValue(cid,config.storages.wrong_answers,0)
                        end
        end
]]></event>
        <event type="login" name="AntiBotLogin" event="buffer"><![CDATA[
        registerCreatureEvent(cid, "AntiBotJoin")
        registerCreatureEvent(cid, "AntiBotLeave")
        registerCreatureEvent(cid, "AntiBotLogout")
        _result = true
]]></event>
        <event type="logout" name="AntiBotLogout" event="buffer"><![CDATA[
        stopEvent(checkAnswerEvent)
        setPlayerStorageValue(cid,config.botonstorage,0)
        setPlayerStorageValue(cid,config.storages.second_num,0)
        setPlayerStorageValue(cid,config.storages.result,0)
        setPlayerStorageValue(cid,config.storages.answer,0)
        setPlayerStorageValue(cid,config.storages.wrong_answers,0)
        _result = true
]]></event>
        <event type="leavechannel" name="AntiBotLeave" event="buffer"><![CDATA[
        domodlib('botshield_config')
                if(channelId == config.channel) then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "BotShield = OFF")
                        doSendAnimatedText(getCreaturePosition(cid), "-stamina", 205)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You won't receive anymore equations, if you left any unanswered they are still active.")
                        setPlayerStamina(cid, 0)
                        setPlayerStorageValue(cid,config.botonstorage,0)
                end
        _result = true
]]></event>
<globalevent name="BotShield" interval="60" event="buffer"><![CDATA[
domodlib('botshield_config')
function onThink(interval, lastExecution, thinkInterval)
        for _, pid in ipairs(getPlayersOnline()) do
                if(getPlayerStorageValue(cid, config.botonstorage) > 0) then
                        local playerpos = getCreaturePosition(cid)
                        local playername = getPlayerName(cid)
            if (getTilePzInfo(playerpos) == FALSE) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
                                local first_num = math.random(1,5)
                                local second_num = math.random(1,5)
                local result = first_num+second_num
                setPlayerStorageValue(cid,storages.first_num,first_num)
                setPlayerStorageValue(cid,storages.second_num,second_num)
                setPlayerStorageValue(cid,storages.result,result)
                doPlayerSendToChannel(cid, cid, 8,"NOTICE: ".. first_num .." + ".. second_num .."= ? You have ".. config.mintoanswer .." minute(s).", 6, time)
                checkAnswerEvent = addEvent(checkAnswer, config.mintoanswer*60*1000,{cid=cid})
            end
                end
        end
_result = true
end
]]></globalevent>
</mod>
what happends when i use the mod is this error.[string "loadBuffer"]:4: attempt to index field 'storages' (a nil value)


Any idea's?
 
^.^ wrong forum. And I aparently storages, is a nil value :p.

I might fix botshield some other time. Don't feel like it though.
 
Back
Top