Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1.     int pc_unequip_from_index(lua_State * L)
  2.     {
  3.         LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  4.  
  5.         if (!lua_isnumber(L, 1))
  6.         {
  7.             sys_err("wrong map index");
  8.             return 0;
  9.         }
  10.  
  11.         if (!lua_isnumber(L, 2))
  12.         {
  13.             sys_err("wrong vnum");
  14.             return 0;
  15.         }
  16.  
  17.         long lMapIndex = (long) lua_tonumber(L, 1);
  18.         DWORD vnum = (DWORD) lua_tonumber(L, 2);
  19.         LPITEM item = NULL;
  20.         if (lMapIndex == ch->GetMapIndex())
  21.         {
  22.             for(BYTE i = 7;i<9;i++)
  23.             {
  24.                 item = ch->GetWear(i);
  25.                 if (item->GetVnum() == vnum)
  26.                 {
  27.                     lua_pushboolean(L, ch->UnequipItem(item) ? true : false);
  28.                     break;
  29.                 }
  30.             }
  31.         }
  32.         return 1;
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement