Jump to content

Allow armor change only every 5 seconds


Recommended Posts

Hi!
Try this:
char.h search:

		//PREVENT_REFINE_HACK
		int		GetRefineTime() const { return m_iRefineTime; }
		void	SetRefineTime() { m_iRefineTime = thecore_pulse(); } 
		int		m_iRefineTime;
		//END_PREVENT_REFINE_HACK

Add this under:

		//PREVENT_ARMOR_WALLHACK
		int		GetArmorUseTime() const { return m_iArmorUseTime; }
		void	SetArmorUseTime() { m_iArmorUseTime = thecore_pulse(); }
		int		m_iArmorUseTime;
		//END_PREVENT_ARMOR_WALLHACK

Then open char_item.cpp and search this in "CHARACTER::EquipItem" function:
 

	if (iWearCell < 0)
		return false;

Add this under:
 

	int equipTime = 5;
	int iPulse = thecore_pulse();

	if (iWearCell == WEAR_BODY)
		SetArmorUseTime();

	if (iWearCell == WEAR_BODY && iPulse - GetArmorUseTime() < PASSES_PER_SEC(equipTime))
	{
		ChatPacket(CHAT_TYPE_INFO, "You can't equip armor so fast");
		return false;
	}

Not tested so I'm not sure it works!
Regards

Link to comment
Share on other sites

20 hours ago, .Incredible™ said:

I know, but i want a Cooldown becouse i think you can Crash a core when you Go outside The map with wallhack

Sorry, my first post was buggy. I've corrected so, it works fine for me.
do the char.h part again, then go to char_item.cpp and search this:

	if (iWearCell < 0)
		return false;

Paste this under:

	int equipTime = 5;
	int iPulse = thecore_pulse();
	
	if (iWearCell == WEAR_BODY)
	{
		if (iPulse - GetArmorUseTime() < PASSES_PER_SEC(equipTime))
		{
			ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't equip armor so fast"));
			return false;
		}
		else
			SetArmorUseTime();
	}

Regards

  • Love 1
Link to comment
Share on other sites

  • 2 years later...
 

 

 You cand use a client side + server side(like the one mentioned above) combination to be sure this is not working.

clientside:

Open uiinventory.py and search:

Spoiler

    def __init__(self):

Add:

Spoiler

        self.lastArmorEquiped = 0

Search:

Spoiler

    def __UseItem(self, slotIndex):
        ItemVNum = player.GetItemIndex(slotIndex)
        item.SelectItem(ItemVNum)

Add under:

Spoiler

        if item.GetItemType() == item.ITEM_TYPE_ARMOR and item.GetItemSubType() == item.ARMOR_BODY:
            if app.GetTime() < self.lastArmorEquiped + 5:
                chat.AppendChat(chat.CHAT_TYPE_INFO, "Poti schimba armura doar peste 5 secunde.")
                return
            else:
                self.lastArmorEquiped = app.GetTime()

Edited by Sobolanescu
  • Metin2 Dev 2
  • Love 2
Link to comment
Share on other sites

In char_item.cpp, search:

	if (iWearCell < 0)
		return false;

Add under:

	if (iWearCell == WEAR_BODY)
	{
		int ArmorUseTime = GetQuestFlag("prevent_wallhack.armor_use_time");
		if (ArmorUseTime)
		{
			if (get_global_time() < ArmorUseTime /* limit */) 
			{
				ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't equip armor so fast"));
				return false;
			}
			else
				SetQuestFlag("prevent_wallhack.armor_use_time", get_global_time() + 3);
		}
	}


In inpug_login.cpp, search:

	ch->StartCheckSpeedHackEvent();

Add under:

	ch->SetQuestFlag("prevent_wallhack.armor_use_time", get_global_time());


It works 100%. I'm using this too
The other two I posted was just a freakin' junk, so sorry for that.
Have a nice day guys! :D

Edited by Heathcliff™
  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.