Jump to content

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
https://metin2.dev/topic/27870-block-to-buy-from-owner-shop-problem/
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
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

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.