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

Feature Anti-Idle Auto Detect Tool

masteuszx

OtsList.eu
Joined
Aug 3, 2008
Messages
784
Reaction score
45
It's FORBIDDEN and ILLEGAL to copy this anywhere!

Hello all!

This script won't be useful for me anymore, so I give that you. ;)

What this script does?
Very good question :D. This detects anti-idle anywhere and ban automatically. Let's say, that this is little part of Cipsoft detection. ;)

This script requires TheForgottenServer in version 0.3.4+!

How to install
====================================
Open file creatureevents.cpp
====================================

Find
Code:
case CREATURE_EVENT_KILL:
			return "onKill";

After it paste:
Code:
case CREATURE_EVENT_DIR:
			return "onDir";

Find
Code:
else if(tmpStr == "kill")
		m_type = CREATURE_EVENT_KILL;

After it paste
Code:
else if(tmpStr == "dir")
		m_type = CREATURE_EVENT_DIR;

Find
Code:
case CREATURE_EVENT_KILL:
			return "cid, target";

After it paste
Code:
case CREATURE_EVENT_DIR:
			return "cid, dir";

At the end of file paste
Code:
uint32_t CreatureEvent::executeOnDir(Creature* creature, const Direction& dir)
{
	//onDir(cid, dir)
	if(m_scriptInterface->reserveScriptEnv())
	{
		ScriptEnviroment* env = m_scriptInterface->getScriptEnv();
		if(m_scripted == EVENT_SCRIPT_BUFFER)
		{
			env->setRealPos(creature->getPosition());

			std::stringstream scriptstream;
			scriptstream << "cid = " << env->addThing(creature) << std::endl;

			scriptstream << m_scriptData;
			int32_t result = LUA_NO_ERROR;
			if(m_scriptInterface->loadBuffer(scriptstream.str()) != -1)
			{
				lua_State* L = m_scriptInterface->getLuaState();
				result = m_scriptInterface->getField(L, "_result");
			}

			m_scriptInterface->releaseScriptEnv();
			return (result == LUA_TRUE);
		}
		else
		{
			#ifdef __DEBUG_LUASCRIPTS__
			std::stringstream desc;
			desc << creature->getName();
			env->setEventDesc(desc.str());
			#endif

			env->setScriptId(m_scriptId, m_scriptInterface);
			env->setRealPos(creature->getPosition());

			lua_State* L = m_scriptInterface->getLuaState();
			m_scriptInterface->pushFunction(m_scriptId);

			lua_pushnumber(L, env->addThing(creature));
			lua_pushnumber(L, dir);

			int32_t result = m_scriptInterface->callFunction(2);
			m_scriptInterface->releaseScriptEnv();
			return (result == LUA_TRUE);
		}
	}
	else
	{
		std::cout << "[Error - CreatureEvent::executeOnLook] Call stack overflow." << std::endl;
		return 0;
	}
}
==========================
Open file creatureevent.h
==========================

Find
Code:
CREATURE_EVENT_KILL,

After it paste
Code:
CREATURE_EVENT_DIR,

Find
Code:
uint32_t executeKill(Creature* creature, Creature* target);

After it paste
Code:
uint32_t executeOnDir(Creature* creature, const Direction& dir);

==========================
Open file game.cpp
==========================

Find
Code:
//event method
	for(it = list.begin(); it != list.end(); ++it)
		(*it)->onCreatureTurn(creature, stackpos);

After it paste
Code:
bool deny = false;
	CreatureEventList dirEvents = creature->getCreatureEvents(CREATURE_EVENT_DIR);
	for(CreatureEventList::iterator it = dirEvents.begin(); it != dirEvents.end(); ++it)
	{
		if(!(*it)->executeOnDir(creature, dir))
		deny = true;		
	}	
		if(deny)
		return false;

Then you can close all and compile.

Lua Files
The lua part is only one file of creatureevents.

Open file creaturescripts/creaturescrtips.xml and paste:
<event type="dir" name="AntyBot" event="script" value="anti-bot.lua"/>

Create file creaturescripts/scripts/anti-bot.lua and paste:
-----------------------------------------------------------------------------------------------------------------
---------------------- ANTI-IDLE AUTO DETECT TOOL ---------------------------------------------------------------
----------------------------------- BY INFINITY (OTIBIA.NET) ----------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
--------------------------- DO NOT REMOVE THIS! -----------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------

local time_b = 7 * 24 * 60 * 60

function onDir(cid, dir)

if isPlayer(cid) then
local gracz = getCreatureName(cid)
local last = getPlayerStorageValue(cid,400240)
local count = getPlayerStorageValue(cid,400250)
local last_change = getPlayerStorageValue(cid,400260)
local now = os.time()

if last < 1 then
setPlayerStorageValue(cid,400240,now)
else
local roznica = now - last
if roznica > 180 then
setPlayerStorageValue(cid,400240,now)
setPlayerStorageValue(cid,400260,roznica)
if (roznica == last_change) or (roznica+1 == last_change) or (roznica == last_change+1) then
if count == 3 then
setPlayerStorageValue(cid,400250,0)
local playeracc = getAccountIdByName(gracz)

doAddBanishment(playeracc, time_b, 12, 2, 'Banished by Anti-Idle Automatic Detection Tool by Infinity', 0)

doRemoveCreature(cid)
else
setPlayerStorageValue(cid,400250,count+1)
end
else
setPlayerStorageValue(cid,400250,0)
end
end
end
end

return TRUE
end

Add to login.lua:
registerCreatureEvent(cid, "AntyBot")

It's FORBIDDEN and ILLEGAL to copy this anywhere!

Please repp++ me ;).

To TFS Developers: if you can, add this function to your own source codes. Thanks.
 
Last edited:
So how does this work? maybe converting the script to english?

It works like it detects the creaturedirection? If so, there are lua functions for it already + it would not be good.
 
This looks for creature direction changes and compare these. It was fully tested by me, and works fine. And no, there is not any lua function for it, this is much better than CreatureThink.

How it works?
Player turn for example left. -> it is saved as time of turning
Player turn for example right after 5 minutes. -> it is saved as time of turning and if the result of last compare is the same, storage is increased by one. If not, its nulled. Easy...

If storage is 3, player is banished.

It detects only Anti-Idle.

maybe converting the script to english?
Are you blind? This is English? Only names of variables are polish. If you want, change this ;x.
 
This looks for creature direction changes and compare these. It was fully tested by me, and works fine. And no, there is not any lua function for it, this is much better than CreatureThink.

How it works?
Player turn for example left. -> it is saved as time of turning
Player turn for example right after 5 minutes. -> it is saved as time of turning and if the result of last compare is the same, storage is increased by one. If not, its nulled. Easy...

If storage is 3, player is banished.

It detects only Anti-Idle.

But what if the player is just after his computer and manualy turns the player to not get kick? He will get banned also.
also lua function:
Lua:
getPlayerLookDir(cid)
exists:O

I think it would be better if the server checked if the player sended a dummy packet or something:) thats my oppinion.
 
Don't be stupid. And what? onUse function and auto detect? LoL? :D

It's MUCH better to check the direction change while it's really changed. Only that allows us to compare time beetwen two turns. =d

Dummy packet? My friend creates new bot, that there is not any "dummy packets". It's bad idea.

In my opinion it's good, I used that at FaniaOTS and in one day there has been banished 20 accounts ;|

Regards.

But what if the player is just after his computer and manualy turns the player to not get kick? He will get banned also.
Stupid. Read what I have written once more. ;x
 
Don't be stupid. And what? onUse function and auto detect? LoL? :D

It's MUCH better to check the direction change while it's really changed. Only that allows us to compare time beetwen two turns. =d

Dummy packet? My friend creates new bot, that there is not any "dummy packets". It's bad idea.

In my opinion it's good, I used that at FaniaOTS and in one day there has been banished 20 accounts ;|

Regards.

Yeah its good for most of them, but some player are actually changing direction manually to not get kicked:p Yeah you are right about the function LOL. I think its faster the way you did it:).

Anyways, good job;) I hope you continue this way:)
 
This looks for creature direction changes and compare these. It was fully tested by me, and works fine. And no, there is not any lua function for it, this is much better than CreatureThink.

How it works?
Player turn for example left. -> it is saved as time of turning
Player turn for example right after 5 minutes. -> it is saved as time of turning and if the result of last compare is the same, storage is increased by one. If not, its nulled. Easy...

If storage is 3, player is banished.

It detects only Anti-Idle.


Are you blind? This is English? Only names of variables are polish. If you want, change this ;x.

The one who's blind is you. Are you expecting someone from The Netherlands (check his location field, or you're blind? ;)) to convert a POLISH script to English? This is what he meant by the first time, change variable names to English. Genius.

Good work anyway...
 
You've made a basic mistake. You can turn the same direction twice, so idle time is re-set to 0 anyway, and the event won't be called (internalCreatureTurn, first line of the Game class member).

I've fixed that.
 
Last edited:
This is what he meant by the first time, change variable names to English.
And what? For what he needs it? I could change names to variable1, variable2, etc. and these comments would disappear instanty. Come on, if you understand LUA, you don't have to get variables in English. ;x

@up
You've made a basic mistake. You can turn the same direction twice, so idle time is re-set to 0 anyway, and the event won't be called (internalCreatureTurn, first line of the Game class member).

Read:
if roznica > 180 then
And then comment. #edit: maybe xd
 
Last edited:
And what? For what he needs it? I could change names to variable1, variable2, etc. and these comments would disappear instanty. Come on, if you understand LUA, you don't have to get variables in English. ;x

@up


Read:

And then comment. #edit: maybe xd
I'm just saying (because I don't know to read polish scripts, sorry, this is english forums) you can turn same direction twice and I've bumped this option a bit (idle time isn't re-set to 0, and you receive both- old & new direction).
 
And what? For what he needs it? I could change names to variable1, variable2, etc. and these comments would disappear instanty. Come on, if you understand LUA, you don't have to get variables in English. ;x

@up


Read:

And then comment. #edit: maybe xd

Well, it wouldn't hurt you to change the variable names yourself, this is an english forum as elfy said. I do understand LUA but I don't understand Polish. Master-m probably needs the variable names in English for the same reason as me, understanding.
 
Good system, however wont work for the common bots.

Common bots such as NG don't turn around, they send other packages instead.

But however you deserve rep for this one :)
 
As Evil Hero said it would only work for less common bots and auto taskers. But its a good measure.
 
No errors when compiling, no errors with lua, not working when dancing with bot, duhhh...
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
Back
Top