Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Player:sendInboxParcel(items, writer)
- if items and type(items) == "table" then
- local parcel, time = Game.createItem(2596), os.time()
- local parcelcontainer = Container(parcel:getUniqueId())
- local inbox = self:getInbox()
- if inbox and parcelcontainer then
- local label, target = parcelcontainer:addItem(2599), self:getName()
- label:setAttribute("text", target)
- label:setAttribute("date", time)
- label:setAttribute("writer", writer:getName())
- for _, item in ipairs(items) do
- if(type(item[2]) == 'string') then
- local tmp = Game.createItem(item[1])
- tmp:setAttribute("text", item[2])
- tmp:setAttribute("date", time)
- tmp:setAttribute("writer", writer:getName())
- parcelcontainer:addItemEx(tmp)
- else
- parcelcontainer:addItem(item[1], item[2] or 1)
- end
- end
- if inbox then
- inbox:addItemEx(parcel, INDEX_WHEREEVER, FLAG_NOLIMIT)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement