Hello there!
Note! This code was tested on tfs 0.2.4+
Information:
This code detects people which use the well known feature from NG, which calculates Players/Monsters health points by spamming the look package from client to the server.
If a player is suspicious, there'll popup a message in your console/gui ("Anti Bot: is suspecting Evil Hero of using a bot.")
don't worry, you don't have to watch your console/gui always.
It'll also be saved in your logs/otadmin.txt file, after the message was send 3x to the console/gui.
If there are still questions about it, feel free to ask.
I'm also taking suggestions to improve the entire system, since it's pretty basic for now.
Implementation:
Player.cpp:
after
add this
goto the bottom of the file and add this
Server version 0.2.4+
Server version 0.3.4+
Player.h:
after
add this
after
add this
Game.cpp:
search for the function
after
add this
If you use 0.3.4+ then add this!
Textlogger.cpp:
Now we are done.
kind regards, Evil Hero.
Note! This code was tested on tfs 0.2.4+
Information:
This code detects people which use the well known feature from NG, which calculates Players/Monsters health points by spamming the look package from client to the server.
If a player is suspicious, there'll popup a message in your console/gui ("Anti Bot: is suspecting Evil Hero of using a bot.")
don't worry, you don't have to watch your console/gui always.
It'll also be saved in your logs/otadmin.txt file, after the message was send 3x to the console/gui.
If there are still questions about it, feel free to ask.
I'm also taking suggestions to improve the entire system, since it's pretty basic for now.
Implementation:
Player.cpp:
after
Code:
nextStepEvent = 0;
add this
Code:
//NG Lookbot detection, made by: Evil Hero and Nicaw
lastLookTime = OTSYS_TIME() / 1000;
lookCount = 0;
lookCount2 = 0;
goto the bottom of the file and add this
Server version 0.2.4+
Code:
//NG Lookbot detection, made by: Evil Hero and Nicaw
void Player::onLookAt(const Position pos)
{
if(lookCount2 > 3)
{
Logger* logger = Logger::getInstance();
logger->logMessage(NULL, LOGTYPE_WARNING, 0,getName() + " is suspected of using a lookbot.", NULL);
lookCount2 = -1;
}
if(lookCount2 == -1)
return;
lookCount++;
if(lookCount > 100)
{
std::cout << "Anti Bot: is suspecting " << getName() << " of using a bot." << std::endl;
//<< (OTSYS_TIME() / 1000 - lastLookTime) << " seconds." << std::endl;
//so if this time is too low player is suspicious
if( (OTSYS_TIME() / 1000 - lastLookTime) < 55 )
{
lookCount2++;
}
lookCount = 0;
lastLookTime = OTSYS_TIME() / 1000;
}
}
Server version 0.3.4+
Code:
//NG Lookbot detection, made by: Evil Hero and Nicaw
void Player::onLookAt(const Position pos)
{
if(lookCount2 > 3)
{
Logger* logger = Logger::getInstance();
logger->eFile("admin.txt", getName() + " is suspected of using a lookbot.", true);
lookCount2 = -1;
}
if(lookCount2 == -1)
return;
lookCount++;
if(lookCount > 100)
{
std::cout << "Anti Bot: is suspecting " << getName() << " of using a bot." << std::endl;
//<< (OTSYS_TIME() / 1000 - lastLookTime) << " seconds." << std::endl;
//so if this time is too low player is suspicious
if( (OTSYS_TIME() / 1000 - lastLookTime) < 55 )
{
lookCount2++;
}
lookCount = 0;
lastLookTime = OTSYS_TIME() / 1000;
}
}
Code:
#include "textlogger.h"
Player.h:
after
Code:
bool hasLearnedInstantSpell(const std::string& name) const;
add this
Code:
//NG Lookbot detection, made by: Evil Hero and Nicaw
void onLookAt(const Position pos);
after
Code:
uint32_t lastIP;
add this
Code:
//NG Lookbot detection, made by: Evil Hero and Nicaw
uint32_t lastLookTime;
uint16_t lookCount;
int16_t lookCount2;
Game.cpp:
search for the function
Code:
bool Game::playerLookAt(uint32_t playerId, const Position& pos, uint16_t spriteId, uint8_t stackPos)
after
Code:
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;
add this
Code:
//NG Lookbot detection, made by: Evil Hero and Nicaw
player->onLookAt(pos);
If you use 0.3.4+ then add this!
Textlogger.cpp:
Code:
#include "player.h"
Now we are done.
kind regards, Evil Hero.
Last edited: