local storage = 45001
local function greetCallback(cid)
local player = Player(cid)
if player:getStorageValue(storage) > 0 then
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
using this as an example..
![]()
forgottenserver/data/npc/scripts/runes.lua at master · otland/forgottenserver
A free and open-source MMORPG server emulator written in C++ - otland/forgottenservergithub.com
I'm pretty sure you can move the buy and sell stuff into an onGreet method
Something like this...?
LUA:local storage = 45001 local function greetCallback(cid) local player = Player(cid) if player:getStorageValue(storage) > 0 then shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook') end return true end
LUA:npcHandler:setCallback(CALLBACK_GREET, greetCallback)
Ah. I knew it sounded too easy. xD@Xikini AsshopModule
is not re-instanciated every time (and it's per npc) it wouldaddBuyableItem
intoshopModule
and all players later could benefit that.
storageId
to addBuyableItem/addSellableItem
and check it later on buy/sell. There's probably easiest way but that was looong time ago