Jump to content

block to buy from owner shop - problem


Recommended Posts

hello i'm trying to block the shop owner to buy his own items, i try many phrases but each time a different player can't buy either... Currently, I am testing, although there were many more attempts, I started with the standard function

	if (m_pkPC->GetPrivShopOwner() > m_pkPC->GetPlayerID())
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "You cant but.");
		return SHOP_SUBHEADER_GC_SOLD_OUT;
	}

no matter what I do, once it is running, no other player can buy either. Any ideas?

  • Good 1
Link to comment
Share on other sites

  • Contributor

You do 2 things wrong. First is the ">", you should use "==". Second you are checking the shop owner player id every time instead of the current character.

	if (m_pkPC->GetPrivShopOwner() == ch->GetPlayerID())
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "You can't buy from yourself.");
		return SHOP_SUBHEADER_GC_SOLD_OUT;
	}

Also GetPrivShopOwner is not exists by default (it is some offline shop?) but for simple shop you can use m_pkPC->GetPlayerID() too.
+1 your GetPrivShopOwner does actually returns the player id? If it returns something else, it will not works.

Edited by TMP4
  • Metin2 Dev 1
Link to comment
Share on other sites

On 9/10/2021 at 8:26 AM, TMP4 said:

You do 2 things wrong. First is the ">", you should use "==". Second you are checking the shop owner player id every time instead of the current character.

	if (m_pkPC->GetPrivShopOwner() == ch->GetPlayerID())
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "You can't buy from yourself.");
		return SHOP_SUBHEADER_GC_SOLD_OUT;
	}

Also GetPrivShopOwner is not exists by default (it is some offline shop?) but for simple shop you can use m_pkPC->GetPlayerID() too.
+1 your GetPrivShopOwner does actually returns the player id? If it returns something else, it will not works.

Thanks ❤️ Check private messages

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.