well i was working on the example of quest by npc and i were playing with it but i need help
its sopost to teleport some one who did not do the quest but it dosent :S can some body help me :S
srry for my english
PHP:
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = 10000
local pos = {x=956, y=1026, z=7}
if(msgcontains(msg, 'quest') or msgcontains(msg, 'job')) then
if(getPlayerStorageValue(cid, storage) < 1) then
npcHandler:say("Hey, you could pass without paying every time, just bring me please {10 crystal coins}.", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Do you have bring the 10 crystal coins for me?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Sorry, you have already done mi quest.", cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveMoney(cid, 100000) == TRUE) then
npcHandler:say("Thanks! As I said,now you can pass with out paying!", cid)
--doPlayerAddItem(cid, 2160, 20)
setPlayerStorageValue(cid, storage, 2)
talkState[talkUser] = 0
else
npcHandler:say("Sorry, you don\'t have enough money.", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
if(msgcontains(msg, 'pass') or msgcontains(msg, 'cross')) then
if(getPlayerStorageValue(cid, storage) < 2) then
npcHandler:say("I can let you go in to the private, you just need to pay a fee. Do you want to cross?", cid)
talkState[talkUser] = 3
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("I can let you go in to the private,if you want to. Do you want to pass?", cid)
talkState[talkUser] = 2
end
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 2) then
if(doTeleportThing(cid, pos)) then
npcHandler:say("Thanks! As I said,now you can pass with out paying. Have fun in the private quarter!", cid)
talkState[talkUser] = 0
elseif talkState[talkUser] == 3 then
npcHandler:say("Ask me for {quest}", cid)
talkState[talkUser] = 0
else
npcHandler:say("Sorry, you don\'t have enough money.", cid)
talkState[talkUser] = 0
end
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
srry for my english