kamilcioo
Veteran OT User
- Joined
- Jul 25, 2008
- Messages
- 979
- Solutions
- 1
- Reaction score
- 291
I got script for exchange 3 items for 1 item and when i got this items isnt work. Npc says to me You dont have items.
Here my script. Please help me.
Here my script. Please help me.
Code:
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 tokenid = 2160
local storage = 7000
local getstorage = getPlayerStorageValue(cid, storage)
local sorrymessage = "Sorry, are you sure you got all items??."
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'quest') then
if getstorage == 1 then
npcHandler:say("You are now finished.", cid)
elseif getstorage < 1 then
npcHandler:say("If you got this three items say {key}", cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'key') then
if getstorage < 1 then
npcHandler:say("You dont have items.", cid)
elseif getstorage == 1 then
npcHandler:say("I have aledry give you this key !!.", cid)
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 1 then
if getstorage < 0 then
if doPlayerRemoveItem(cid, tokenid, 1) == TRUE then
npcHandler:say("Ye' brought the key, needed to complete the quest'.", cid)
setPlayerStorageValue(cid, storage, 1)
doPlayerAddItem(cid, 2091, 1)
doPlayerRemoveItem(cid, 10309, 1)
doPlayerRemoveItem(cid, 8266, 1)
doPlayerRemoveItem(cid, 6534, 1)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, tokenid, 1) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
end
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandler:say("Sure, come back later!", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())