E
Evil Puncker
Guest
I have the following code (using TFS 1.3), and what I'm trying to do is, when the player use !bestiary rat, it gets the value from the storage in the table, but right now I can't figure out the proper code:
PS: it is a revscriptsys
Lua:
local monsters = {
["rat"] = 35001,
["troll"] = 35002,
["rotworm"] = 35003,
["dragon"] = 35004,
["dragon lord"] = 35005,
["demon"] = 35006,
}
local bestiary = TalkAction("!bestiary")
function bestiary.onSay(player, words, param)
local t = string.explode(param, ",")
local tmp = t[1]
if t[2] then
tmp = t[2]
end
if param == '' then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Usage: !bestiary monster name")
return true
end
local killedMonsters = player:getStorageValue(t[1])
if not killedMonsters then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have not killed any " .. t[1] .. " yet.")
return true
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have already killed " .. killedMonsters .. " " .. t[1] .. "s.")
end
return true
end
bestiary:separator(" ")
bestiary:register()
PS: it is a revscriptsys