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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(getPlayerStorageValue(cid, 10100, 1) == -1 or getPlayerStorageValue(cid, 10101, 1) == -1) then
if(msgcontains(msg, 'help') or msgcontains(msg, 'mission')) then
npcHandler:say("I\'m looking for {sniper gloves}, I can give you a nice addon if you bring it to me. Will you help me with this gloves?.", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerStorageValue(cid, 10100, 1) == -1) then
npcHandler:say("Come back when you get the legendary {sniper gloves}, I think sometime you can kill some hunters in hunter tower.", cid)
setPlayerStorageValue(cid, 10100, 1)
else
npcHandler:say("Then dont lose my time.", cid)
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandler:say("Come back if you got that gloves.", cid)
end
return true
end
end
if(getPlayerStorageValue(cid, 10100, 1) == 1) then
if(msgcontains(msg, 'help') or msgcontains(msg, 'mission') or msgcontains(msg, 'sniper gloves')) then
npcHandler:say("Did you get a {sniper gloves} for me?", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 5875, 1)) then
npcHandler:say("Thank you, there is your reward. And from now you can {trade} with me.", cid)
doSendMagicEffect(getCreaturePosition(cid), 13)
if getPlayerSex(cid) == 1 then
setPlayerStorageValue(cid,10103,1)
doPlayerAddOutfit(cid, 129, 2)
elseif getPlayerSex(cid) == 0 then
setPlayerStorageValue(cid,10103,1)
doPlayerAddOutfit(cid, 137, 2)
end
setPlayerStorageValue(cid, 10101, 1)
setPlayerStorageValue(cid, 10100, 0)
else
npcHandler:say("Come back when you get {sniper gloves} for me!.", cid)
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandler:say("Come back if you got that gloves.", cid)
end
return true
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
And here is the error:
TFS 1.0
Anyone could fix for me this script? I know i wrote it like nób :< but i just started with lua :-/
Last edited by a moderator: