santa12 4 Posted September 10, 2021 Share Posted September 10, 2021 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? 1 Link to comment Share on other sites More sharing options...
Contributor TMP4 11106 Posted September 10, 2021 Contributor Share Posted September 10, 2021 (edited) 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 September 10, 2021 by TMP4 1 Link to comment Share on other sites More sharing options...
santa12 4 Posted September 14, 2021 Author Share Posted September 14, 2021 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 More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now