Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getItemsInContainer(cont, sep)
- local text = ""
- local tsep = ""
- local count = ""
- for i=1, sep do
- tsep = tsep.."-"
- end
- tsep = tsep..">"
- for i=0, getContainerSize(cont.uid)-1 do
- local item = getContainerItem(cont.uid, i)
- if isContainer(item.uid) == FALSE then
- if item.type > 1 then
- count = " ("..item.type.."x)"
- end
- text = text.."\n"..tsep..getItemName(item.itemid)..""..count.." ("..item.itemid..")"
- else
- if getContainerSize(item.uid) > 0 then
- text = text.."\n"..tsep..getItemName(item.itemid).." ("..item.itemid..")"
- text = text..getItemsInContainer(item, sep+2)..""
- else
- text = text.."\n"..tsep..getItemName(item.itemid).." ("..item.itemid..")"
- end
- end
- end
- return text
- end
- function onSay(cid, words, param)
- if(param == '') then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
- return false
- end
- local slotName = {"Head", "Amulet", "Backpack", "Armor", "Right Hand", "Left Hand", "Legs", "Feet", "Ring", "Ammo Slot"}
- local t = param:split(', ')
- if getPlayerGroupId(cid) >= 3 then
- id = getItemIdByName(t[1])
- if not id then
- doPlayerSendCancel(cid, "The "..t[1].." not exist. ")
- return false
- end
- local resultID = db.storeQuery("SELECT name FROM players WHERE id IN (SELECT player_id FROM player_items WHERE itemtype = ".. id.. ");")
- local msg = "Search results by item ".. getItemName(id) .." in your database:\n\n"
- if resultID then
- while true do
- local name = result.getDataString(resultID, 'name')
- msg = msg .. name .."\n"
- if not result.next(resultID) then
- break
- end
- end
- else
- msg = msg .. "The item was not found in any player."
- end
- doShowTextDialog(cid, id, msg)
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement