• 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 Anti-Push bot | Works 100%

Some in game.cpp above previous function or in tools.cpp/tools.h:
PHP:
bool isFromPlayerToGround(position frompos, position topos)
{
if(frompos.x == 65535 && frompos.y >= 64 && frompos.y <= 79 && topos.x != 65535)
 return true;

if(frompos.x == 65535 && frompos.y <= 10 && topos.x != 65535)
 return true;

return false;
}

PHP:
char buffer[90];
if(g_config.getBool(ConfigManager::ANTI_PUSH) && player->hasCondition(CONDITION_EXHAUST, EXHAUST_MOVE_ITEMS) && g_config.getString(ConfigManager::ANTI_PUSH_ITEMS).find(itoa(item->getID(),buffer,10)) != std::string::npos && isFromPlayerToGround(fromPos,toPos))
    {
        player->sendTextMessage(MSG_INFO_DESCR, "You cannot move this object.\nAnti-Push prevention.");
        return false;
    }
    int16_t indexItem = toIndex;
    ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
    if(ret == RET_NOERROR)
    {
     if(g_config.getBool(ConfigManager::ANTI_PUSH) && g_config.getString(ConfigManager::ANTI_PUSH_ITEMS).find(itoa(item->getID(),buffer,10)) != std::string::npos && isFromPlayerToGround(fromPos,toPos))
     {
             int32_t ticks = g_config.getNumber(ConfigManager::ANTI_PUSH_DELAY);
             player->addExhaust(ticks, EXHAUST_MOVE_ITEMS);
     }
     return true;
    }

But still, again, I never tested it, also I'm not sure about names of variables (fromPos and toPos) because it may be frompos and topos (lower cased).
Basicaly it will only delay pushing if item is moved from player slot/backpack to ground, otherwise it won't be delayed.
 
the version 0.3.5 does not work, there are no errors, I can throw away non-stop and there is no fatigue ;/
 
PHP:
bool isFromPlayerToGround(position frompos, position topos)
{
if(frompos.x == 65535 && frompos.y >= 64 && frompos.y <= 79 && topos.x != 65535)
 return true;

if(frompos.x == 65535 && frompos.y <= 10 && topos.x != 65535)
 return true;

return false;
}
Won't work :confused:. If the item is on the inventory/backpack/equipped It will be the same position as the player, not 65535 as X, and why Y >= 64 or <= 10? I don't understand xD.
Btw, tested and not working. Btw2, I've also made the system with only counts if from player to ground, look it hehe.
 
Won't work :confused:. If the item is on the inventory/backpack/equipped It will be the same position as the player, not 65535 as X, and why Y >= 64 or <= 10? I don't understand xD.
Btw, tested and not working. Btw2, I've also made the system with only counts if from player to ground, look it hehe.

Well, should be that second, because it's how Tibia protocol recognises that. (pos.x = 65535 means that item was moved from player equipment or backpack, pos.y means from bp or slot).
I suppose OTS programmers did it otherwise, I guess they didn't need that here.
 
The system has been fixed, so now it works in both os Linux & Windows.

Regards.
 
working version TFS 0.3.5
Lua:
// Anti-Push feature Prevention System by Xampy //
    if(g_config.getBool(ConfigManager::ANTI_PUSH))
    {
        int16_t indexItem = toIndex;
        std::string antiPushItems = g_config.getString(ConfigManager::ANTI_PUSH_ITEMS);
        if(antiPushItems.size())
        {
            IntegerVec tmpVec = vectorAtoi(explodeString(antiPushItems, ","));
            if(tmpVec[0] != 0)
            {            
                int i;
                int arraySize = tmpVec.size();
                i = 0;
                for(IntegerVec::iterator it = tmpVec.begin(); it != tmpVec.end(); ++it)
                {
                    i++;
                    if(indexItem < 1 && item->getID() == uint32_t(*it))
                    {
                        if(player->hasCondition(CONDITION_EXHAUST, 5))
                        {
                            player->sendTextMessage(MSG_INFO_DESCR, "You cannot move this object.\nAnti-Push prevention.");
                            return false;
                        }
                        else
                        {
                            ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
                            if(ret == RET_NOERROR)
                            {
                                 int32_t ticks = g_config.getNumber(ConfigManager::ANTI_PUSH_DELAY);
                                player->addExhaust(ticks, 5);
                                return true; 
                            }  
                            player->sendCancelMessage(ret);
                            return false;
                        }
                    }
                    else
                    {
                        if(arraySize == i)
                        {
                            ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
                            if(ret == RET_NOERROR)
                                return true;
                            player->sendCancelMessage(ret);
                            return false;
                        }
                    }
                }
            }
        }
       }
       else
       {
        ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
        if(ret == RET_NOERROR)
            return true;   
        player->sendCancelMessage(ret);
        
        return false;
    }
     
    return false;
// Anti-Push feature Prevention System by Xampy //
 
working version TFS 0.3.5
Lua:
// Anti-Push feature Prevention System by Xampy //
    if(g_config.getBool(ConfigManager::ANTI_PUSH))
    {
        int16_t indexItem = toIndex;
        std::string antiPushItems = g_config.getString(ConfigManager::ANTI_PUSH_ITEMS);
        if(antiPushItems.size())
        {
            IntegerVec tmpVec = vectorAtoi(explodeString(antiPushItems, ","));
            if(tmpVec[0] != 0)
            {            
                int i;
                int arraySize = tmpVec.size();
                i = 0;
                for(IntegerVec::iterator it = tmpVec.begin(); it != tmpVec.end(); ++it)
                {
                    i++;
                    if(indexItem < 1 && item->getID() == uint32_t(*it))
                    {
                        if(player->hasCondition(CONDITION_EXHAUST, 5))
                        {
                            player->sendTextMessage(MSG_INFO_DESCR, "You cannot move this object.\nAnti-Push prevention.");
                            return false;
                        }
                        else
                        {
                            ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
                            if(ret == RET_NOERROR)
                            {
                                 int32_t ticks = g_config.getNumber(ConfigManager::ANTI_PUSH_DELAY);
                                player->addExhaust(ticks, 5);
                                return true; 
                            }  
                            player->sendCancelMessage(ret);
                            return false;
                        }
                    }
                    else
                    {
                        if(arraySize == i)
                        {
                            ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
                            if(ret == RET_NOERROR)
                                return true;
                            player->sendCancelMessage(ret);
                            return false;
                        }
                    }
                }
            }
        }
       }
       else
       {
        ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
        if(ret == RET_NOERROR)
            return true;   
        player->sendCancelMessage(ret);
        
        return false;
    }
     
    return false;
// Anti-Push feature Prevention System by Xampy //
Why the CONDITION_EXHAUST should be 5?
Not tested, but code from main post should work also in 0.3.6 or/and 0.3.5
 
Last edited:
to be sure I set 5,
This line:
if(item->getID() == uint32_t(*it) && indexItem < 1 && mapFromPos == mapToPos)
also been changed removed && mapFromPos == mapToPos cause code to run only in the deposit box. (Now I work on all over the map)

//text translate.
 
to be sure I set 5,
This line:

also been changed removed && mapFromPos == mapToPos cause code to run only in the deposit box. (Now I work on all over the map)

//text translate.

Why do you removed that? Now it won't work properly. It will detect as Anti-Push also if you move a gold coin from player to the ground, even though the tile isn't the same position as the player.
 
Last edited:
Great job Xampy! Thx a lot.

Just one thing, I cant find "STAMINA_DESTROY_LOOT," inside the configmanager.h (maybe because of the rev I`m using? idk) should "ANTI_PUSH_DELAY, " be inside the "enum number_config_t"?? or where should I add it?
 
Last edited:
Directory??
You must access to the SVN and donwload them. Link: http://otland.net/subversion.php?sv...er&path=/tags/0.3.6pl1/&rev=83&peg=83&isdir=1 (TFS 0.3.6.pl1 ~ rev.80)
Great job Xampy! Thx a lot.

Just one thing, I cant find "STAMINA_DESTROY_LOOT," inside the configmanager.h (maybe because of the rev I`m using? idk) should "ANTI_PUSH_DELAY, " be inside the "enum number_config_t"?? or where should I add it?
Yeah, it's on 0.4, dunno if it's on 0.3 or 0.2
Yes, it should be inside the "enum_number_config_t", you're correct.
 
it works pretty nice with older revs, now in the new one i dont find where to modify they chn¡anged game.cpp
 
-- Anti-Push Prevention System by Xampy
useAntiPush = true --// enabled = true or disabled = false
antiPushDelay = 3000 --// default is 3000 (3 seconds)
antiPushItems = "2148,2152,2160,3976" --// add as much items as you want separated by comma
If i add this to my config.lua file, my gesior dies :(
 
it works pretty nice with older revs, now in the new one i dont find where to modify they chn¡anged game.cpp
Uhms, I don't really now what has been modified so I'm not a premium user right now.
If i add this to my config.lua file, my gesior dies :(
Hmm, yes, it's because off "-- ++ // == etc.", just leave it like this:
Lua:
-- AntiPush Prevention System by Xampy
useAntiPush = true
antiPushDelay = 3000
antiPushItems = "2148,2152,2160,3976"
 
Back
Top