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

Little problem c++


blaxis

Question

Hi, I need check MySQL -> item -> window type from 50264 vnum item.

Examp:

 

char_item.cpp UseItemEx in CASE 50264:

if (XXX == window_type)
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("bla_bla_bla"));
	return false;
}

window_type = mysql -> item -> in 'window' column

 

I try this;

TItemPos Cell;
BYTE window_type = Cell.window_type;
if (MALL == window_type)
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("bla_bla_bla"));
	return false;
}

but didn't work.

 

Pls help me?

Sorry for my bad english.

Edited by blaxis
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • Moderator
2 hours ago, blaxis said:
TItemPos Cell;
BYTE window_type = Cell.window_type;
if (MALL == window_type)
{
	[...]
}

 

It won't work because you just initialized the structure with the default values from the constructor, which means window_type will be always INVENTORY

You already have the GetWindow function inside of CItem class, you can use it like this:

if (MALL == item->GetWindow())
{
	[...]
}

Or if you really want to use TItemPos and the functions from it, you must initialize it properly:

const TItemPos Cell(item->GetWindow(), item->GetCell());
Edited by VegaS™
  • Metin2 Dev 1
  • Good 2
Link to comment
Share on other sites

  • 0
49 minutes ago, VegaS™ said:

Yapıyı yapıcıdan gelen varsayılan değerlerle başlattığınız için çalışmaz , bu da window_type her zaman ENVANTER olacağı anlamına gelir

CItem sınıfının içinde GetWindow işlevine  zaten sahipsiniz  , bunu şu şekilde kullanabilirsiniz:

 

	

Ya da TItemPos'u ve onun fonksiyonlarını gerçekten kullanmak istiyorsanız, onu düzgün bir şekilde başlatmanız gerekir:

  

Thank you very much!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • 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.