X
Xikini
Guest
0.3.7
I say: /quest test
shows expected dialogue.
I say it again: /quest test
shows 'Quest name test is not an existing quest.'
First time trying to work with strings and talkactions, but it's driving me crazy.
Can someone tell me why it's doing this, or show me where my mistake is?
I say: /quest test
shows expected dialogue.
I say it again: /quest test
shows 'Quest name test is not an existing quest.'
First time trying to work with strings and talkactions, but it's driving me crazy.
Can someone tell me why it's doing this, or show me where my mistake is?
Code:
local quest = {
["test"] = {storage = 45001},
["test two"] = {storage = 45002},
}
function onSay(cid, words, param, channel)
param = param:lower()
quest_exists = quest[param]
local str = ""
if param == "" or not param then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Quest name blank is not an existing quest.")
return true
end
if quest_exists then
quest = quest_exists
storage = quest.storage
for _, pid in ipairs(getPlayersOnline()) do
str = str .. "" .. getPlayerStorageValue(pid, storage) .." | " .. getCreatureName(pid ).. "\n"
end
doShowTextDialog(cid, 1956, "Showing online player status of " .. param ..":\n\n" .. str .. "")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Quest name " .. param .. " is not an existing quest.")
end
return true
end