pixelshasHUN 4 Posted June 28, 2021 Share Posted June 28, 2021 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 More sharing options...
Active Member Solution Volvox 1510 Posted June 28, 2021 Active Member Solution Share Posted June 28, 2021 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 More sharing options...
pixelshasHUN 4 Posted June 28, 2021 Author Share Posted June 28, 2021 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! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now