Jump to content

Using item every few seconds


Recommended Posts

// CHAR.H

public:
	DWORD GetLastEquipCostumeTime() const { return m_dwLastEquipCostumeTime; }

private:
	DWORD m_dwLastEquipCostumeTime;

};

CHAR.CPP
//	m_dwKillerPID = 0;
//	m_iMoveCount = 0;
	m_dwLastEquipCostumeTime = 0;


//CHAR_ITEM.CPP

		case ITEM_COSTUME:
		{
			int CalcLastEquipSec = (get_dword_time() - ch->GetLastEquipCostumeTime()) / 3000;

			if (CalcLastMoveSec < 3) // Replace 3 with seconds number.
			{
				ChatPacket(CHAT_TYPE_INFO, "Wait three seconds");
				return false;
			}

			if (!item->IsEquipped())
			{
				EquipItem(item);
			}
			else
			{
				UnequipItem(item);
			}
		}
		break;

 

  • Love 2
Link to comment
Share on other sites

Or just this simple code:

find in char_item.cpp :

        case ITEM_PICK:
            // END_OF_MINING
            if (!item->IsEquipped())
                EquipItem(item);
            else
                UnequipItem(item);
            break;

replace with:

        case ITEM_PICK:
            if (!item->IsEquipped())
                {
                if (GetQuestFlag("ARMOR.CHECKER") && get_global_time() < GetQuestFlag("ARMOR.CHECKER"))
                {
                     ChatPacket(CHAT_TYPE_INFO, " you need to wait %d sec.",  (GetQuestFlag("ARMOR.CHECKER") - get_global_time()) % 60);
                    return false;
                }
                EquipItem(item);
                SetQuestFlag("ARMOR.CHECKER", get_global_time() + 3);
                }
            else
                UnequipItem(item);
            break;

 

  • Love 1
Link to comment
Share on other sites

Acum 11 minute, kasko30 a spus:

Or just this simple code:

find in char_item.cpp :


        case ITEM_PICK:
            // END_OF_MINING
            if (!item->IsEquipped())
                EquipItem(item);
            else
                UnequipItem(item);
            break;

replace with:


        case ITEM_PICK:
            if (!item->IsEquipped())
                {
                if (GetQuestFlag("ARMOR.CHECKER") && get_global_time() < GetQuestFlag("ARMOR.CHECKER"))
                {
                     ChatPacket(CHAT_TYPE_INFO, " you need to wait %d sec.",  (GetQuestFlag("ARMOR.CHECKER") - get_global_time()) % 60);
                    return false;
                }
                EquipItem(item);
                SetQuestFlag("ARMOR.CHECKER", get_global_time() + 3);
                }
            else
                UnequipItem(item);
            break;

 

I do not like working with QuestFlags where it is not necessary.

 

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.