Xampy
PHP | SQL | LUA | C++
- Joined
- Jun 22, 2008
- Messages
- 1,109
- Reaction score
- 17
Hello!
I'm making this in a request by kito2. It works with TFS 0.4 | Not tested with TFS 0.3.X neither 0.2.X!
What does it do?
It detects if you're moving an object/item with an ID that is set in config.lua (configurable) then it adds an exhaustion of X ms (configurable). If you try to move an "anti-push item" (dunno how to call it) then it will say an error message if you're exhausted yet. Basically what it does is making non-working Anti-Push bot feature.
It has been added by default these items:
- 2148 (Gold Coin)
- 2152 (Platinum Coin)
- 2160 (Crystal Coin)
- 3976 (Worms)
Surely nobody will throw crystal coins while the anti-push is working, but it has been added by default, you can remove it if you want, or add other items, as you prefer.
Credits goes to:
· Xampy (me) for making the system.
· .3lite for helping me to read arrays from config.lua
Ok, let's start:
Go to line 1440~ of game.cpp and replace this:
by this:
Then open player.h and replace this:
by this:
Now open configmanager.cpp and after this:
paste this:
Finally, open configmanager.h and after this:
paste this:
2)after this:
paste this:
3)after this:
paste this:
Now compile the server and paste this in the config.lua file:
Now you can run the server and you're done.
This system is enabled by default with 3000ms of exhaustion.
It has been fully tested, and no errors have been found. If you think something is not working properly, ask for help in this thread.
Enjoy!
I'm making this in a request by kito2. It works with TFS 0.4 | Not tested with TFS 0.3.X neither 0.2.X!
What does it do?
It detects if you're moving an object/item with an ID that is set in config.lua (configurable) then it adds an exhaustion of X ms (configurable). If you try to move an "anti-push item" (dunno how to call it) then it will say an error message if you're exhausted yet. Basically what it does is making non-working Anti-Push bot feature.
It has been added by default these items:
- 2148 (Gold Coin)
- 2152 (Platinum Coin)
- 2160 (Crystal Coin)
- 3976 (Worms)
Surely nobody will throw crystal coins while the anti-push is working, but it has been added by default, you can remove it if you want, or add other items, as you prefer.
Credits goes to:
· Xampy (me) for making the system.
· .3lite for helping me to read arrays from config.lua
Ok, let's start:
Go to line 1440~ of game.cpp and replace this:
PHP:
ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL);
if(ret == RET_NOERROR)
return true;
player->sendCancelMessage(ret);
return false;
PHP:
// 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(item->getID() == uint32_t(*it) && indexItem < 1 && mapFromPos == mapToPos)
{
if(player->hasCondition(CONDITION_EXHAUST, EXHAUST_MOVE_ITEMS))
{
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, EXHAUST_MOVE_ITEMS);
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 //
PHP:
enum Exhaust_t
{
EXHAUST_COMBAT = 1,
EXHAUST_HEALING = 2
};
PHP:
enum Exhaust_t
{
EXHAUST_COMBAT = 1,
EXHAUST_HEALING = 2,
EXHAUST_MOVE_ITEMS = 3
};
PHP:
m_confBool[ADDONS_PREMIUM] = getGlobalBool("addonsOnlyPremium", true);
PHP:
m_confBool[ANTI_PUSH] = getGlobalBool("useAntiPush", true);
m_confNumber[ANTI_PUSH_DELAY] = getGlobalNumber("antiPushDelay", 3000);
m_confString[ANTI_PUSH_ITEMS] = getGlobalString("antiPushItems", "");
PHP:
ADDONS_PREMIUM,
PHP:
ANTI_PUSH,
PHP:
STAMINA_DESTROY_LOOT,
PHP:
ANTI_PUSH_DELAY,
PHP:
ADMIN_ENCRYPTION_DATA,
PHP:
ANTI_PUSH_ITEMS,
PHP:
-- 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
This system is enabled by default with 3000ms of exhaustion.
It has been fully tested, and no errors have been found. If you think something is not working properly, ask for help in this thread.
Enjoy!
Last edited: