Facebook
From Smelly Gibbon, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 56
  1. -- Equipment spy by Azi [ersiu] --
  2. function getItemsInContainer(cont, sep)
  3.     local text = ""
  4.     local tsep = ""
  5.     local count = ""
  6.     for i=1, sep do
  7.         tsep = tsep.."-"
  8.     end
  9.     tsep = tsep..">"
  10.     for i=0, getContainerSize(cont.uid)-1 do
  11.         local item = getContainerItem(cont.uid, i)
  12.         if isContainer(item.uid) == FALSE then
  13.             if item.type > 0 then
  14.                 count = "("..item.type.."x)"
  15.             end
  16.             text = text.."\n"..tsep..getItemNameById(item.itemid).." "..count
  17.         else
  18.             if getContainerSize(item.uid) > 0 then
  19.                 text = text.."\n"..tsep..getItemNameById(item.itemid)
  20.                 text = text..getItemsInContainer(item, sep+2)
  21.             else
  22.                 text = text.."\n"..tsep..getItemNameById(item.itemid)
  23.             end
  24.         end
  25.     end
  26.     return text
  27. end
  28.  
  29. function onSay(cid, words, param, channel)
  30. checkExhausted(cid, 1000, 5) -- zawed el line da ta7t kol function onSay
  31.     if(param == "") then
  32.         doPlayerSendCancel(cid, "Command requires param.")
  33.         return TRUE
  34.     end
  35.     local slotName = {"Head Slot", "Amulet Slot", "Backpack Slot", "Armor Slot", "Right Hand", "Left Hand", "Legs Slot", "Feet Slot", "Ring Slot", "Ammo Slot"}
  36.     local player = getPlayerByNameWildcard(param)
  37.     if isPlayer(player) == TRUE then
  38.         local text = getPlayerName(player).."'s Equipment: "    
  39.         for i=1, 10 do
  40.             text = text.."\n\n"
  41.             local item = getPlayerSlotItem(player, i)
  42.             if item.itemid > 0 then
  43.                 if isContainer(item.uid) == TRUE then
  44.                     text = text..slotName[i]..": "..getItemNameById(item.itemid)..getItemsInContainer(item, 1)
  45.                 else
  46.                     text = text..slotName[i]..": "..getItemNameById(item.itemid)
  47.                 end
  48.             else
  49.                 text = text..slotName[i]..": Empty"
  50.             end
  51.         end
  52.         doShowTextDialog(cid, 6579, text)
  53.     else
  54.         doPlayerSendCancel(cid, "This player is not online.")
  55.     end
  56.     return TRUE
  57. end