• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Addon NPC with *Items and Cash*

Martiimeus

●тнυg●ℓιƒє● ρα¢ 4 єνєя
Joined
Feb 3, 2009
Messages
500
Reaction score
1
Location
gєямαηу
Hello Guys,

I want to make that addons would be rare..

as I know all players are going to buy both addons from the npc if they got only 15k well, I wanted to make a npc which gives you the first addon for 65k and the second addon should be an item.

But then I failed at this, so I was going to tell you, my problem in the hope that you guys would do this for me.
Of course I would rep you for this work or give YOU the credits for. Just try to help me ;)

An Example:

HTML:
hi/first citizen addon/-blablabla for 65k?/yes
hi/second citizen addon/-did you brought me a frozen starlight?/yes

_____________

HTML:
hi/first hunter addon/-blablabla for 65k?/yes
hi/second hunter addon/-brought me an arbalest?

_____________

HTML:
hi/first demonhunter addon/-blablabla for 65k?/yes
hi/second demonhunter addon/-brought me a demon armor?/yes

_____________

HTML:
hi/first yalaharian addon/-blablabla for 65k?/yes
hi/second yalaharian addon/-brought me a yalahari armor?/yes


*That was an example what the player should say (and for every vocation another sentences) when he wants to buy addons for some outfits.*:thumbup:

Hope you understand me, please fast ;)

Regards,
Martii~:wub:
 
Try this..

Try this..
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

function buyAddons(cid, message, keywords, parameters, node)
--TODO: buyAddons function in modules.lua
if(not npcHandler:isFocused(cid)) then
return false
end

local addon = parameters.addon
local cost = parameters.cost
local premium = (parameters.premium ~= nil and parameters.premium)

if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then
if doPlayerRemoveMoney(cid, cost) == TRUE then
doPlayerAddAddons(cid, addon)
npcHandler:say('There, you are now able to use all addons!', cid)
else
npcHandler:say('Sorry, you do not have enough money.', cid)
end
else
npcHandler:say('I only serve customers with premium accounts.', cid)
end

keywordHandler:moveUp(1)
return true
end

local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for 5000 gold coins?'})
node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = 65000, premium = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for 10000 gold coins?'})
node2:addChildKeyword({'yes'}, buyAddonsWithItems, {addon = 2, itemid = XXXX, count = 10, premium = true})
})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for 65000 gold coins and the second addons set for XX item.'})

npcHandler:addModule(FocusModule:new())
 
Back
Top