• 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!

TFS OTS 8.60 NEED HELP NPC EXCHANGE VIP COIN FOR VIP.

Latorre01

New Member
Joined
Aug 14, 2019
Messages
22
Reaction score
2
In this script the NPC is selling vip for 100k, i want him to sell the vip for itens instead of gold. How can I do it?

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 buyVip(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end

if doPlayerRemoveMoney(cid, parameters.price) then
addVipDays(cid, parameters.days)
npcHandler:say('Thanks, you buy '..parameters.days..' vip days. You have '..getVipDays(cid)..' vip days.', cid)
else
npcHandler:say('Sorry, you don\'t have enough money.', cid)
end

npcHandler:resetNpc()
return true
end

local node1 = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy 30 vip days for 1000000 gp\'s?'})
node1:addChildKeyword({'yes'}, buyVip, {price = 1000000, days = 30})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

npcHandler:addModule(FocusModule:new())
 
Read this

You only need to change this
Lua:
doPlayerRemoveMoney(cid, parameters.price)
to this
Lua:
doPlayerRemoveItem(cid, vipcoinid, price)
And the text Sorry, you don\'t have enough money to what ever you need.
 
Last edited:
Back
Top