[Request] Vending Blocker in all worlds

05/02/2018 15:38 Minotaurr#1
Hey people !

I'm trying to add a code in my source where the creation of shops are blocked in every world but not in my Market world.

I've tried to add this code to my DPSrvr.cpp

Code:
#ifdef __SHOP_BLOCK
if (pWorld && pWorld->GetID() != WI_WORLD_MARKET);
	{
		pUser->AddText("Travel to the Market to open a shop !");
		return;
	}
#endif //__SHOP_BLOCK
&

In my VersionCommon.h of WorldServer
Code:
#define  __SHOP_BLOCK
But players can still create shops everywhere.

Can anyone tell me what I'm doing wrong? I think I have to add something to Neuz?

Thanks!
Minotaurr
05/02/2018 17:05 Meutledaron#2
c/p complete function please
05/02/2018 17:32 Rhea03#3
try this all can block vending except areas you want to allow
DPSrvr.cpp
LOOK FOR
ADD BELOW
IF YOU WANT TO ALLOW ONLY IN FLARIS ITS LIKE THE SAME
ONLY IN FLARIS CITY ALLOW AREA
OR IF YOU WANT TO SAINT MORNING AND FLARIS ALLOWING VENDING
LIKE THIS
ONLY IN SM CITY and FLARIS ALLOW AREA

WorldServer
Versioncommon: #define __ALLOW_VENDING_AREA
05/02/2018 18:56 Minotaurr#4
Quote:
Originally Posted by Meutledaron View Post
c/p complete function please
What do you mean??

Quote:
Originally Posted by Rhea03 View Post
try this all can block vending except areas you want to allow
DPSrvr.cpp
LOOK FOR
ADD BELOW
IF YOU WANT TO ALLOW ONLY IN FLARIS ITS LIKE THE SAME
ONLY IN FLARIS CITY ALLOW AREA
OR IF YOU WANT TO SAINT MORNING AND FLARIS ALLOWING VENDING
LIKE THIS
ONLY IN SM CITY and FLARIS ALLOW AREA

WorldServer
Versioncommon: #define __ALLOW_VENDING_AREA
Actually I want it per world, not per region :$
05/02/2018 19:15 ZeroTwo02#5
Quote:
Originally Posted by Minotaurr View Post
I've tried to add this code to my DPSrvr.cpp

Code:
#ifdef __SHOP_BLOCK
if (pWorld && pWorld->GetID() != WI_WORLD_MARKET);
	{
		pUser->AddText("Travel to the Market to open a shop !");
		return;
	}
#endif //__SHOP_BLOCK
Where you try to add that piece of code?
You need to include it in the function "CDPSrvr::OnPVendorOpen"
05/02/2018 19:15 RedBuIl#6
void CDPSrvr::OnPVendorOpen( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize )
{
if( uBufSize > 55 ) // 4 + 4 + 48 - 1 = 55
return;

char szPVendor[MAX_VENDORNAME]; // 개인 상점 이름( 48 )
ar.ReadString( szPVendor, MAX_VENDORNAME );

CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
if( IsValidObj( pUser ) )
{
#ifdef __MARKET_TELEPORT_NPC
if( pUser->GetWorld()->GetID() != WI_WORLD_MARKET )
{
pUser->AddText("GO TO THE MARKET FOR A SHOP PUTA");
return ;
}
#endif // __MARKET_TELEPORT_NPC
05/03/2018 13:54 Minotaurr#7
Quote:
Originally Posted by RedBuIl View Post
void CDPSrvr::OnPVendorOpen( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize )
{
if( uBufSize > 55 ) // 4 + 4 + 48 - 1 = 55
return;

char szPVendor[MAX_VENDORNAME]; // 개인 상점 이름( 48 )
ar.ReadString( szPVendor, MAX_VENDORNAME );

CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
if( IsValidObj( pUser ) )
{
#ifdef __MARKET_TELEPORT_NPC
if( pUser->GetWorld()->GetID() != WI_WORLD_MARKET )
{
pUser->AddText("GO TO THE MARKET FOR A SHOP PUTA");
return ;
}
#endif // __MARKET_TELEPORT_NPC
I used this code, and it works with the message.

But, when I'm in WI_WORLD_MARKET. I get the same message.

I can't open shops anywhere right now :P

How did I do this lol
05/05/2018 05:56 xToffer#8
Quote:
Originally Posted by Minotaurr View Post
I used this code, and it works with the message.

But, when I'm in WI_WORLD_MARKET. I get the same message.

I can't open shops anywhere right now :P

How did I do this lol
try to remove the "!"
05/05/2018 06:23 Mushpoie#9
Quote:
Originally Posted by xToffer View Post
try to remove the "!"
You may want to read up on C++ operators.
[Only registered and activated users can see links. Click Here To Register...]

Anyways...

In: CDPSrvr::OnPVendorOpen(

Below:
Code:
		CWorld* pWorld = pUser->GetWorld();
		if( pWorld && pWorld->GetID() == WI_WORLD_GUILDWAR )
		{			
			pUser->AddText( prj.GetText(TID_GAME_GUILDCOMBAT_CANNOT_TRADE) );
			return;
		}
Add:
Code:
		if( pWorld && pWorld->GetID() != WI_WORLD_MARKET )
		{			
			pUser->AddText( "No shops allowed.." );
			return;
		}
Change the text to w/e.
05/06/2018 16:26 Minotaurr#10
Quote:
Originally Posted by Minotaurr View Post
I used this code, and it works with the message.

But, when I'm in WI_WORLD_MARKET. I get the same message.

I can't open shops anywhere right now :P

How did I do this lol
I had to define the worlds in source & resource. Forgot it in source.

Works now :)