Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. if questSystem[item.actionid].rewards.items then
  2.     local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)
  3.     if Container(backpack) and Container(backpack):getEmptySlots(true) >= 1 then
  4.         local totalWeight = 0
  5.         local items = questSystem[item.actionid].rewards.items
  6.         for i = 1, #items do
  7.             local item = ItemType(items[i].id)
  8.             if item then
  9.                 local weight = item:getWeight(items[i].count)
  10.                 totalWeight = totalWeight + weight
  11.             end
  12.         end
  13.         if player:getFreeCapacity() > totalWeight then
  14.             if #items > 1 then
  15.                 local bag = (#items > 8 and 1988 or 1987)
  16.                 local message = "You have found " .. ItemType(bag):getArticle() .. " " .. ItemType(bag):getName() .. " containing "
  17.                 local add = player:addItem(bag)
  18.                 add = Container(add)
  19.                 if add then
  20.                     for i = 1, #items do
  21.                         add:addItem(items[i].id, items[i].count)
  22.                         if i < #items then
  23.                             message = message .. (items[i].count > 1 and items[i].count or ItemType(items[i].id):getArticle()) .. " " .. (items[i].count > 1 and ItemType(items[i].id):getPluralName() or ItemType(items[i].id):getName()) .. ", "
  24.                         else
  25.                             message = message .. "and " .. (items[i].count > 1 and items[i].count or ItemType(items[i].id):getArticle()) .. " " .. (items[i].count > 1 and ItemType(items[i].id):getPluralName() or ItemType(items[i].id):getName()) .. "."
  26.                         end
  27.                     end
  28.                     player:addItemEx(add)
  29.                     player:sendTextMessage(MESSAGE_INFO_DESCR, message)
  30.                 else
  31.                     print("Internal error: questSystem - no container to add items to.")
  32.                     player:sendTextMessage(MESSAGE_STATUS_WARNING, "Internal error, please contact the GM.")
  33.                 end
  34.             else
  35.                 player:addItem(items[1].id, items[1].count)
  36.                 player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found " .. (items[1].count > 1 and items[1].count or ItemType(items[1].id):getArticle()) .. " " .. (items[1].count > 1 and ItemType(items[1].id):getPluralName() or ItemType(items[1].id):getName()) .. ".")
  37.             end
  38.         else
  39.             player:sendTextMessage(MESSAGE_STATUS_WARNING, "bla bla bla u no gots cap")
  40.         end
  41.     else
  42.         player:sendTextMessage(MESSAGE_STATUS_WARNING, "bla bla bla u no gots room")
  43.     end
  44. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top