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

TalkAction BotShield Pro v3.1 [discontinued]

Status
Not open for further replies.
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
TFS version?
What was happening ingame?
 

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Best answers
0
Reaction score
102
Location
The Netherlands
updated the server.

TFS 0.3.4pl2

I was just walking around, testing the system, with a 1 minute to answer, and 2 minute checkdelay.

So I opened the BotShield channel, and it got turned on.
I was waiting a while, and it showed up.
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
hmm, ill check it out when i get home, gtg to work now :/ sorry. Be back tonight
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
read bottom of first post -.-
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
3,017
Best answers
76
Reaction score
527
Location
Germany
Nice :) However I don't like way you done it (Some tips: 1: from what I saw, all answer*.lua files are the same, just some values changed so maybe merge it to 1 file. 2: storages currently aren't configurable because in talkactions you are overriding them (dofile). 3: in answer10.lua there is sending message to channel with '15', but I don't see it declared anywhere. 4: globaevents would be faster instead starting events for every single player. 5: maybe make stamina configurable? Why it should break compatiblity ;)

Reeepp+++ [;
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
yeah all those are good tips, thanks, and I got impatient at the end so i just made alot of lua files lol. like I said it really wasnt meant to be configurable, i wasn't going to release it but i decided through and threw a config in there without thinking about it lol. I may update when i get time
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
Nice :) However I don't like way you done it (Some tips: 1: from what I saw, all answer*.lua files are the same, just some values changed so maybe merge it to 1 file. 2: storages currently aren't configurable because in talkactions you are overriding them (dofile). 3: in answer10.lua there is sending message to channel with '15', but I don't see it declared anywhere. 4: globaevents would be faster instead starting events for every single player. 5: maybe make stamina configurable? Why it should break compatiblity ;)

Reeepp+++ [;
duly noted, updating right now, newest version will be for 0.3.5 only. Using mod system, explain more on globalevents, thats only part im having trouble with
 

Zaxuhe

C++ PHP
Joined
Jan 1, 2008
Messages
228
Best answers
0
Reaction score
4
Thanks not actually using this, but based an script of mine on this, THANKS!
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
Updated script, version 2, many changes see first post
 

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,979
Best answers
2
Reaction score
105
Location
Germany
Litle bug..
Lua:
  local config = {
    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
    channel = 6, -- what channel is BotShield on in channels.xml (make sure Answers.lua is on same channel)
    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."
}
Why is there..
Lua:
        if(channelId == 6) then
Should be..
Lua:
        if(channelId == config.channel) then
:thumbup:

Regards,
Shawak
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
o must have missed that, thanks
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
3,017
Best answers
76
Reaction score
527
Location
Germany
Main idea with mods, was to not interfere in data/ files, and currently you're doing that (Need to modify channels.xml & login.lua). User shouldn't touch these files and all should be done in mods. You can place ALL - talkactions, channels, login *everything* in 1 .xml mod file, which will be really much easier for end user who'll need *just* to copy this simply file to mods/ folder. Installation and de-installation in this case will be done just be settings enabled="yes/no". In what you posted currently its impossible because you need copy/paste couple of files. Currently I have 40+ mods on my server, and imagine how it would look if every mod was splited into x files.

About globalevents I mean doing 1 loop for example every 60 seconds, like this, instead event for each player.

Code:
<globalevent interval="60" event="script"><![CDATA[
function onThink(interval, lastExecution, thinkInterval)
	for _, pid in ipairs(getPlayersOnline()) do
		if(getPlayerStorageValue(cid, #STORAGE#) >= 0) then
			-- something
		end
	end

	return TRUE
end
]]></globalevent>
There are currently not much examples with mods, so I understand that peoples can't understand how it works, soon there will be more examples.
 
OP
Syntax

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,873
Best answers
0
Reaction score
258
Location
Texas
ok i think i understand what your saying with globalevent, and could you pm me some mods of urs as an example, take out the important parts if you want, i just need to know how they all work and what all i can do with them

EDIT:
Ok few more questions, do I have to modify login.lua or how would i register it? and also this is correct right

<?xml version="1.0" encoding="UTF-8"?>
<mod name="BotShield Pro" version="2.1" author="Syntax" contact="[email protected]" enabled="yes">
<description>
This mod will enable mid-level bot prevention in your server.
</description>
<talkaction words="2" script="Answers.lua" log="no"/>
<talkaction words="3" script="Answers.lua" log="no"/>
<talkaction words="4" script="Answers.lua" log="no"/>
<talkaction words="5" script="Answers.lua" log="no"/>
<talkaction words="6" script="Answers.lua" log="no"/>
<talkaction words="7" script="Answers.lua" log="no"/>
<talkaction words="8" script="Answers.lua" log="no"/>
<talkaction words="9" script="Answers.lua" log="no"/>
<talkaction words="10" script="Answers.lua" log="no"/>
<event type="joinchannel" name="AntiBotLogin" script="BotShield.lua"/>
<channel id="CHANNEL#" active="no" name="BotShield"/>
</mod>
 
Last edited:

zakius

Enter the Ninja!
Joined
Apr 30, 2009
Messages
2,635
Best answers
0
Reaction score
61
Location
with Taiga
I modified it a bit to make it working all the time and on default channel.
And now even when I answer correct it says that I failed and that stuff.
Can someone check what is wrong, because I cannot find anything, for me looks good.
And no errors in the console ofc.

botshield.lua
Code:
local mintoanswer = 1 -- minutes to answer anti bot system....needs to be lower than delayAntiBot
local delayAntiBot = 3 -- minutes of delay of delayAntiBot....needs to be higher than mintoanswer
 
local storages = {first_num = 20123, second_num = 20124, result = 20125, answer = 20126, wrong_answers = 20129}

function onLogin(cid)
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "BotShield = ON")
          antiBotEvent = addEvent(antiBot,1000,{cid=cid})
        return TRUE
end

function onLogout(cid)
        stopEvent(antiBotEvent)
        stopEvent(checkAnswerEvent)
        setPlayerStorageValue(cid,storages.first_num,0)
        setPlayerStorageValue(cid,storages.second_num,0)
        setPlayerStorageValue(cid,storages.result,0)
        setPlayerStorageValue(cid,storages.answer,0)
        setPlayerStorageValue(cid,storages.wrong_answers,0)
        return TRUE
end

function antiBot(parameters)
        local cid = parameters.cid
        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)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"NOTICE: ".. first_num .." + ".. second_num .."= ? You have ".. mintoanswer .." minute(s).")
                        checkAnswerEvent = addEvent(checkAnswer, mintoanswer*60*1000,{cid=cid})
                end
        antiBotEvent = addEvent(antiBot,delayAntiBot*60*1000,{cid=cid})
end

function checkAnswer(parameters)
        local cid = parameters.cid
        local first_num, second_num, result, answer = getPlayerStorageValue(cid,storages.first_num), getPlayerStorageValue(cid,storages.second_num), getPlayerStorageValue(cid,storages.result), getPlayerStorageValue(cid,storages.answer)
        local wrong_answers = getPlayerStorageValue(cid,storages.wrong_answers)
                if (wrong_answers > 3) then
                        setPlayerStorageValue(cid,storages.wrong_answers,0)
                        setPlayerStorageValue(cid,storages.first_num,0)
                        setPlayerStorageValue(cid,storages.second_num,0)
                        setPlayerStorageValue(cid,storages.result,0)
                        setPlayerStorageValue(cid,storages.answer,0)
                        doAddNotation(getPlayerAccountId(cid), 3, 4, BotShield, auto)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"NOTICE: Failed! Too many attempts.")
                        doPlayerPopupFYI(cid, "You faild")
                elseif (answer ~= 1 and result > 0) then
                        setPlayerStorageValue(cid,storages.first_num,0)
                        setPlayerStorageValue(cid,storages.second_num,0)
                        setPlayerStorageValue(cid,storages.result,0)
                        setPlayerStorageValue(cid,storages.answer,0)
                        setPlayerStorageValue(cid,storages.wrong_answers,0)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "NOTICE: Failed! Time limit has been reached.")
                        doAddNotation(getPlayerAccountId(cid), 3, 4, "BotShield", auto)
                        doPlayerPopupFYI(cid, "You faild")
                else
                        setPlayerStorageValue(cid,storages.first_num,0)
                        setPlayerStorageValue(cid,storages.second_num,0)
                        setPlayerStorageValue(cid,storages.result,0)
                        setPlayerStorageValue(cid,storages.answer,0)
                        setPlayerStorageValue(cid,storages.wrong_answers,0)
        end
end
and answers.lua

Code:
function onSay(cid, words, param, channel)
local storages = {first_num = 20123, second_num = 20124, result = 20125, answer = 20126, wrong_answers = 20129}
local first_num = getPlayerStorageValue(cid,storages.first_num)
local second_num = getPlayerStorageValue(cid,storages.second_num)
local result = getPlayerStorageValue(cid,storages.result) 
local answer = getPlayerStorageValue(cid,storages.answer)
doCreatureSay(cid, words, 1)
if (answer ~= 1 and result > 0) then
	if (words == result) then
		if (getPlayerStorageValue(cid,storages.wrong_answers) <= 3) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Accepted.")
			setPlayerStorageValue(cid,storages.wrong_answers,0)
			setPlayerStorageValue(cid,storages.answer,1)
			setPlayerStorageValue(cid,storages.first_num,0)
			setPlayerStorageValue(cid,storages.second_num,0)
			setPlayerStorageValue(cid,storages.result,0)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Correct, too many attempts though, you may relog to prevent punishment if you aren't AFK.")
		end
	else
		wrong_answers_now = getPlayerStorageValue(cid,storages.wrong_answers)
		setPlayerStorageValue(cid,storages.wrong_answers,wrong_answers_now+1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Incorrect. ".. getPlayerStorageValue(cid,storages.wrong_answers).."/3 failed attempts.")
	end
end
end
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
3,017
Best answers
76
Reaction score
527
Location
Germany
ok i think i understand what your saying with globalevent, and could you pm me some mods of urs as an example, take out the important parts if you want, i just need to know how they all work and what all i can do with them

EDIT:
Ok few more questions, do I have to modify login.lua or how would i register it? and also this is correct right
yes you must register it, you can do it this way:

Code:
<event type="login" name="AntiBotLogin" event="buffer/><![CDATA[
	registerCreatureEvent(cid, "AntiBotJoinChannel")
	_result = true
]]></event>
 
Status
Not open for further replies.
Top