I wan't fix this script,when player have done "xxx" quest then he can trade with NPC.I use TFS 0.3.5 pl1.
eace:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|. Im selling elite loot only for good players. Did you do djin quest ? Say {trade}.")
function selleliteloot(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
queststatus = getPlayerStorageValue(cid,1057633)
if (parameters.confirm ~= true) and (parameters.decline ~= true) then
if queststatus == -1 then
npcHandler:say('Sorry, but you dont did djin quest!', cid)
npcHandler:resetNpc()
return false
end
end
return false
end
local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true})
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addSellableItem({'serpent sword'}, 2409, 900, 'serpent sword')
shopModule:addSellableItem({'dragonbone staff'}, 7430, 2500, 'dragonbone staff')
shopModule:addSellableItem({'giant sword'}, 2393, 17000, 'giant sword')
shopModule:addSellableItem({'ice rapier'}, 2396, 1000, 'ice rapier')
shopModule:addSellableItem({'fire sword'}, 2392, 4000, 'fire sword')
shopModule:addSellableItem({'war hammer'}, 2391, 1200, 'war hammer')
shopModule:addSellableItem({'skull staff'}, 2436, 6000, 'skull staff')
shopModule:addSellableItem({'dragon hammer'}, 2434, 2000, 'dragon hammer')
shopModule:addSellableItem({'dragon lance'}, 2414, 9000, 'dragon lance')
shopModule:addSellableItem({'fire axe'}, 2432, 8000, 'fire axe')
shopModule:addSellableItem({'guardian halberd'}, 2427, 10000, 'guardian halberd')
shopModule:addSellableItem({'naginata'}, 2426, 1000, 'naginata')
shopModule:addSellableItem({'obsidian lance'}, 2425, 500, 'obsidian lance axe')
shopModule:addSellableItem({'knight axe'}, 2430, 4000, 'knight axe')
shopModule:addSellableItem({'royal helmet'}, 2498, 30000, 'royal helmet')
shopModule:addSellableItem({'warrior helmet'}, 2475, 5000, 'warrior helmet')
shopModule:addSellableItem({'crown helmet'}, 2491, 2500, 'crown helmet')
shopModule:addSellableItem({'devil helmet'}, 2462, 1000, 'devil helmet')
shopModule:addSellableItem({'strange helmet'}, 2479, 500, 'strange helmet')
shopModule:addSellableItem({'dragon scale mail', 'dsm'}, 2492, 40000, 'dragon scale mail')
shopModule:addSellableItem({'golden armor'}, 2466, 15000, 'golden armor')
shopModule:addSellableItem({'crown armor'}, 2487, 12000, 'crown armor')
shopModule:addSellableItem({'knight armor'}, 2476, 5000, 'knight armor')
shopModule:addSellableItem({'blue robe'}, 2656, 15000, 'blue robe')
shopModule:addSellableItem({'crown legs'}, 2488, 12000, 'crown legs')
shopModule:addSellableItem({'knight legs'}, 2477, 5000, 'knight legs')
shopModule:addSellableItem({'demon shield'}, 2520, 25000, 'demon shield')
shopModule:addSellableItem({'vampire shield'}, 2534, 15000, 'vampire shield')
shopModule:addSellableItem({'medusa shield'}, 2536, 9000, 'medusa shield')
shopModule:addSellableItem({'crown shield'}, 2519, 8000, 'crown shield')
shopModule:addSellableItem({'tower shield'}, 2528, 8000, 'tower shield')
shopModule:addSellableItem({'dragon shield'}, 2516, 4000, 'dragon shield')
shopModule:addSellableItem({'steel boots', 'sbs'}, 2645, 40000, 'steel boots')
shopModule:addSellableItem({'boots of haste', 'boh'}, 2195, 30000, 'boots of haste')
shopModule:addSellableItem({'platinum amulet'}, 2171, 3000, 'platinum amulet')
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.'})
npcHandler:addModule(FocusModule:new())
eace: