Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×
  • 0

block to buy from owner shop - problem


santa12

Question

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

2 answers to this question

Recommended Posts

  • 0
  • Distinguished Member

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

!-->
  • 0
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 0

      Need Help With Char_Item.cpp

    2. 0

      ULTERIUS2.COM

    3. 7

      Killua - Unholy God Set

    4. 2

      Visual studio 2022 compiling issue

    5. 991

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.