Im trying to make a quest system.. so I made this function..
but I need this to return -1 if the row doesnt exist.
I'm getting this error:
anyway.. test.lua
Example:
Table quests is empty.
execute: getQuestStorage(cid, quest_name)
if player got this quest return storage value. else return -1.
I know my English is sux.. I''m learning. Hope someone understand it.
PHP:
function getQuestStorage(cid, name)
local player = getPlayerGUID(cid)
local quest = db.getResult("SELECT `storage` FROM `quests` WHERE `name` ='"..name.."' and `player_id` ='"..player.."';")
return quest:getDataInt("storage")
end
I'm getting this error:
PHP:
[26/03/2009 12:22:21] Lua Script Error: [TalkAction Interface]
[26/03/2009 12:22:21] data/talkactions/scripts/custom/test.lua:onSay
[26/03/2009 12:22:21] data/lib/database.lua:39: [Result:getDataInt]: Result not set!
[26/03/2009 12:22:21] stack traceback:
[26/03/2009 12:22:21] [C]: in function 'error'
[26/03/2009 12:22:21] data/lib/database.lua:39: in function <data/lib/database.lua:37>
[26/03/2009 12:22:21] (tail call): ?
[26/03/2009 12:22:21] data/talkactions/scripts/custom/test.lua:3: in function <data/talkactions/scripts/custom/test.lua:1>
PHP:
function onSay(cid, words, param)
doPlayerSendTextMessage(cid,19,"".. getQuestStorage(cid, name) .."")
return TRUE
end
Example:
Table quests is empty.
execute: getQuestStorage(cid, quest_name)
if player got this quest return storage value. else return -1.
I know my English is sux.. I''m learning. Hope someone understand it.