Candlejack
Don't hug me I'm scared
Basically I don't want the player to be able to trade with an NPC unless this storage variable is set to 1.
This isn't working! Any thoughts? Thank you!
This isn't working! Any thoughts? Thank you!
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local storage = 5556
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
local shopModule = ShopModule:new()
local function creatureSayCallback(cid, type, msg)
if msgcontains(msg, "trade") then
if getPlayerStorageValue(cid, storage) == 1 then
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'scythe'}, 2550, 800, 1, 'scythe')
shopModule:addSellableItem({'gram of heroin', 'gram of heroin'}, 5886, 500, 'gram of heroin')
shopModule:addSellableItem({'gram of weed', 'gram of weed'}, 10608, 175, 'gram of weed')
shopModule:addSellableItem({'cocaine', 'cocaine'}, 4849, 400, 'cocaine')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
else
npcHandler:say("Sorry, You're not allowed to use this shop.", cid)
end
end
end
Last edited: