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

Server source block USE_ADD_ATTRIBUTE


pixelshasHUN

Question

I want to block add attribute to a specified item but when I'm testing it the server is going to close.

					case USE_PUT_INTO_BELT_SOCKET:
					case USE_PUT_INTO_RING_SOCKET:
					case USE_PUT_INTO_ACCESSORY_SOCKET:
					case USE_ADD_ACCESSORY_SOCKET:
					case USE_CLEAN_SOCKET:
					case USE_CHANGE_ATTRIBUTE:
					case USE_CHANGE_ATTRIBUTE2 :
					case USE_ADD_ATTRIBUTE:
					case USE_ADD_ATTRIBUTE2:
						{
							LPITEM item2;
							if (item2->GetVnum() == 53030)
								return false;

What am i doing wrong?

 

Link to comment
Share on other sites

  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0
  • Bronze
5 minutes ago, pixelshasHUN said:
LPITEM item2;
							if (item2->GetVnum() == 53030)

If you declare item2 as LPITEM then at this point it is empty.
When you call item2->GetVnum() on an empty variable, then Server will crash.
You need to define, what item2 is.
 

e.g. do it like this
 

	if (!IsValidItemPosition(DestCell) || !(item2 = GetInventoryItem(wDestCell)))
					return false;

this will define item2.

Link to comment
Share on other sites

  • 0
1 minute ago, V0lvox said:

If you declare item2 as LPITEM then at this point it is empty.
When you call item2->GetVnum() on an empty variable, then Server will crash.
You need to define, what item2 is.
 

e.g. do it like this
 

	if (!IsValidItemPosition(DestCell) || !(item2 = GetInventoryItem(wDestCell)))
					return false;

this will define item2.

Oh i see. Thanks for the help!

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

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

    2. 3

      Biologist Manager (C++ & LUA)

    3. 3

      Visual studio 2022 compiling issue

    4. 63

      Metin2 | Mount System Renewal

    5. 58

      Metin2 2004 Beta Client

    6. 0

      🔥Paradise2 PVP SERVER GLOBAL!! EN-ES-PT 🕐📢Apertura 11 de diciembre 21 horas de España!

    7. 0

      Please help here ( Sush system problem )

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