Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. function Player:sendInboxParcel(items, writer)
  2. if items and type(items) == "table" then
  3. local parcel, time = Game.createItem(2596), os.time()
  4. local parcelcontainer = Container(parcel:getUniqueId())
  5. local inbox = self:getInbox()
  6. if inbox and parcelcontainer then
  7. local label, target = parcelcontainer:addItem(2599), self:getName()
  8. label:setAttribute("text", target)
  9. label:setAttribute("date", time)
  10. label:setAttribute("writer", writer:getName())
  11.  
  12. for _, item in ipairs(items) do
  13. if(type(item[2]) == 'string') then
  14. local tmp = Game.createItem(item[1])
  15. tmp:setAttribute("text", item[2])
  16. tmp:setAttribute("date", time)
  17. tmp:setAttribute("writer", writer:getName())
  18.  
  19. parcelcontainer:addItemEx(tmp)
  20. else
  21. parcelcontainer:addItem(item[1], item[2] or 1)
  22. end
  23. end
  24.  
  25. if inbox then
  26. inbox:addItemEx(parcel, INDEX_WHEREEVER, FLAG_NOLIMIT)
  27. end
  28. end
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement