Hello.
Error:
Script:
Error:
[09/08/2010 21:31:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/artifact.lua
[09/08/2010 21:31:26] data/npc/scripts/artifact.lua:19: ')' expected near 'then'
Script:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, '1 broken artifact') or (msgcontains(msg, 'mystic box of ve') then
selfSay('Do you want to change your {1 broken artifact} for {mystic box of ve} ?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 10684) >= 1 then
if(doPlayerRemoveItem(cid, 10684, 1) or doPlayerRemoveItem(cid, 10684, 1) then
doPlayerAddItem(cid, 10840, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have {1 broken artifact}!', cid)
end
end
if(msgcontains(msg, '10 broken artifact') or (msgcontains(msg, 'mystic box of tha') then
selfSay('Do you want to change your {10 broken artifacts} for {mystic box of tha} ?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 10684) >= 10 then
if(doPlayerRemoveItem(cid, 10684, 10) or doPlayerRemoveItem(cid, 10684, 10) then
doPlayerAddItem(cid, 10839, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have {10 broken artifacts}!', cid)
end
end
if(msgcontains(msg, '15 broken artifact') or (msgcontains(msg, 'mystic box of car') then
selfSay('Do you want to change your {10 broken artifacts} for {mystic box of car} ?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 10684) >= 15 then
if(doPlayerRemoveItem(cid, 10684, 15) or doPlayerRemoveItem(cid, 10684, 15) then
doPlayerAddItem(cid, 10841, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have {15 broken artifacts}!', cid)
end
end
if(msgcontains(msg, '25 broken artifact') or (msgcontains(msg, 'mystic box of aB') then
selfSay('Do you want to change your {25 broken artifacts} for {mystic box of aB} ?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 10684) >= 25 then
if(doPlayerRemoveItem(cid, 10684, 25) or doPlayerRemoveItem(cid, 10684, 25) then
doPlayerAddItem(cid, 10842, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have {25 broken artifacts}!', cid)
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())