-
Posts
259 -
Joined
-
Last visited
-
Feedback
0%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Posts posted by alondark
-
-
uptade koray
-
game and db ?
- 1
-
23 hours ago, wezt said:
Hello!
I'd like to show you how you can check position for shops (probably offline shops too).
I don't like when the map is full of shops or when shops are too close for each other. So I've made few functions for checking if the shop is in safezone or if it too close to other shops.Let's start
char.h
Find there:
void CloseMyShop(); protected: LPSHOP m_pkShop; LPSHOP m_pkMyShop; std::string m_stShopSign; LPCHARACTER m_pkChrShopOwner;
Add few new lines:
void CloseMyShop(); void SetShopValidPos(bool value) { m_bShopValidPos = value; } bool GetShopValidPos() { return m_bShopValidPos; } protected: LPSHOP m_pkShop; LPSHOP m_pkMyShop; std::string m_stShopSign; LPCHARACTER m_pkChrShopOwner; bool m_bShopValidPos;
char.cpp
In 'void CHARACTER::Initialize()' find:
m_pkMyShop = NULL;
Add below:
m_bShopValidPos = true;
Then search for 'void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)'
Add above new function:
struct CheckShopPos { LPCHARACTER m_ch; CheckShopPos(LPCHARACTER ch) { m_ch = ch; } void operator()(LPENTITY ent) { if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) ent; if (ch->GetRaceNum()!=30000) //shop mob vnum return; if (DISTANCE_APPROX(ch->GetX() - m_ch->GetX(), ch->GetY() - m_ch->GetY()) < 200) //distance between shops { m_ch->SetShopValidPos(false); } } } };
Then in 'void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)' search for:
if (bItemCount == 0) return;
Add below:
//shops pos check LPSECTREE sectree = NULL; sectree = GetSectree(); if (sectree) { SetShopValidPos(true); CheckShopPos f(this); sectree->ForEachAround(f); if(!GetShopValidPos()) { ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (too close to other shop)."); return; } if (!sectree->IsAttr(GetX(), GetY(), ATTR_BANPK)) { ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (use safezone)."); return; } } //shops pos check
P.s:
1. Make backups before change your source.
2. If you'll repost this solution somewhere, please keep credits.
3. Likes and comments appreciated.That's all, have fun
Regards.hello
how we do new markets
https://metin2.download/picture/ge83X21H0XvckjfT9uk0h3qTfr3S6hI1/.png
the codes of the market
mob cod (30002)30003)30004)
These New Markets Are Blocked
system thank you
-
if you give me scale, i give you if ismounting control
-
ahahaha its not problem bro, this is a system
-
3 better than 4, i have speedtree 3 and 4.2 + 3ds max plugin but i cant install plugin, any idea please ?
-
-
c'mon man, what do not you help me
-
-
help me too amk
-
-
-
you can find with python scripts
-
thank amkınıkoyam
- 1
-
Just now, VegaS said:
Not equal to a != b
a not_eq b
Yes Yes
bool K::operator !=(S const& b);
bool K::operator!=(S const& b) const;
bool operator !=(K const& a, S const& b);
Greater than or equal to a >= b
Yes Yesbool K::operator >=(S const& b) const;
bool operator >=(K const& a, S const& b);
Less than or equal toa <= b
Yes Yesbool K::operator <=(S const& b);
bool operator <=(K const& a, S const& b);
sorry my fail
- 1
-
you use "=!" for if not
-
for txt ?
-
What Is This Exactly
-
1 hour ago, DexterSK said:
METIN2 TURK?
yes turk
-
bune amk
speak englız thank
-
thank bebek
-
-
-
ok gays burdadamı actın god
Notice system ? I pay
in Paid Support / Searching / Recruiting
Posted
is this metin2 ?