I made this command based in a script by Nahruto.
This command will obtain the loot of a monster.
Create a file called monster_info.lua and paste this
Add this to talkactions.xml
Example: /minfo bosses/ghazbaran
This command will obtain the loot of a monster.
Create a file called monster_info.lua and paste this
Lua:
function onSay(cid, words, param, channel)
local monsterFile = "data/monster/" .. param .. ".xml"
local loot = {}
local t = 0
local text = "File opened: " .. monsterFile .. ""
if (io.open(monsterFile, "r") ~= nil) then
for line in io.lines(monsterFile) do
if (line:find('id=".*".*')) then
line = string.match(line, 'id=".*".*')
lootid = string.sub(line, string.find(line, '="') + 2, string.find(line, '" ') - 1)
table.insert(loot, lootid)
end
end
text = text .. "\n\n" .. "Found " .. #loot .. " items\n"
for _, i in ipairs(loot) do
t = t + 1
text = text .. "\n " .. t .. ". " .. getItemArticleById(i) .. " " .. getItemNameById(i) .. " [" .. i .. "]"
end
doPlayerPopupFYI(cid, text)
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "File: " .. monsterFile .. " does not exist.")
return TRUE
end
return TRUE
end
Add this to talkactions.xml
Lua:
<talkaction log="yes" words="/minfo" event="script" value="monster_info.lua" />
Example: /minfo bosses/ghazbaran
Last edited: