Jump to content

Server source block USE_ADD_ATTRIBUTE


Go to solution Solved by Volvox,

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Active Member
  • Solution
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

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!

  • Good 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



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