Jump to content

[C++] Function block pickup items in event


VegaS™
 Share

Recommended Posts

A member from this community called for a tutorial with this so I made this little tutorial with several functions.

 

These functions can be applied during an event to lock assembly automatic any items Self pickup because stiim with all that many players join a private server when an event such as a break Metin and get xx chests, and players use most illegal software in order to collect as many chests or any item.

 

Command in game for disable/activate:

/e enable_block_table_pickup 1  -> Activate

/e enable_block_table_pickup 0  -> Disable

 

a89864422b2ad320bc0c7b3c3faa0468.gif

 

 

- [ File: /Src/common/service.h ]

#define __ENABLE_BLOCK_PICKUP__ // Enables blocking of special items that can not be collected
#define __ENABLE_BLOCK_PICKUP__WARNING "[Block PickUp] You cannot collect this item when event is active!"

- [ File: /Src/common/length.h ]

enum TablePickupItem
{
	BLOCK_VNUM_0 = 50011,
	BLOCK_VNUM_1 = 50124,
	BLOCK_VNUM_2 = 50125,
	BLOCK_VNUM_3 = 50126,
	BLOCK_VNUM_4 = 50127,
	BLOCK_VNUM_5 = 50128,
	BLOCK_VNUM_6 = 50129,
	BLOCK_VNUM_7 = 50130,
	BLOCK_VNUM_8 = 50131,
	BLOCK_VNUM_9 = 50132,
	BLOCK_VNUM_10 = 50133,
};

- [ File: /Src/game/char_item.cpp ]

 

#1.) Search:

    if (!item || !item->GetSectree())
	        return false;

#2.) Add bellow:

#ifdef __ENABLE_BLOCK_PICKUP__
	DWORD vegas_dwEventFlagBlockPickup = quest::CQuestManager::instance().GetEventFlag("enable_block_table_pickup");
	
	if (vegas_dwEventFlagBlockPickup > 0)
	{	
		if (IS_TABLE_BLOCK_PICKUP(item->GetVnum()))
		{
			ChatPacket(CHAT_TYPE_NOTICE, __ENABLE_BLOCK_PICKUP__WARNING);	
			return false;
		}
	}	
#endif 

#3.) Search:

static bool FN_check_item_socket(LPITEM item)
{
	[........]
}

#4.) Add bellow:

#ifdef __ENABLE_BLOCK_PICKUP__
static bool IS_TABLE_BLOCK_PICKUP(int vnum)
{
	switch (vnum)
	{
		case BLOCK_VNUM_0:
		case BLOCK_VNUM_1:
		case BLOCK_VNUM_2:
		case BLOCK_VNUM_3:
		case BLOCK_VNUM_4:
		case BLOCK_VNUM_5:
		case BLOCK_VNUM_6:
		case BLOCK_VNUM_7:
		case BLOCK_VNUM_8:
		case BLOCK_VNUM_9:
		case BLOCK_VNUM_10:
            return true;
	}
	return false;
}
#endif
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...