chupaescadatri
Banned User
- Joined
- Jul 5, 2014
- Messages
- 338
- Reaction score
- 49
NPC does not recognize who is premium,
even with premium he says that the player needs to premium and does not sell promotion.
and the boats did not recognize the premium and sells ticket to any city even for free accounts.
how to fix?
Config.lua:
NPC/Scripts/Promotion.lua:
Modules.lua:
even with premium he says that the player needs to premium and does not sell promotion.
and the boats did not recognize the premium and sells ticket to any city even for free accounts.
how to fix?
Config.lua:
Code:
-- Premium account
freePremium = false
premiumForPromotion = true
removePremiumOnInit = true
Code:
-- This is an example NPC script that can be used on Jiddo's NPC system
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, promotion = 1, cost = 20000, premium = false, level = 20, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})
npcHandler:addModule(FocusModule:new())
Code:
--Usage:
-- local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
-- node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20}, text = 'Congratulations! You are now promoted.')
-- node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Allright then. Come back when you are ready.'}, reset = true)
function StdModule.promotePlayer(cid, message, keywords, parameters, node)
local npcHandler = parameters.npcHandler
if(npcHandler == nil) then
error('StdModule.promotePlayer called without any npcHandler instance.')
end
if(cid ~= npcHandler.focus) then
return false
end
if(isPremium(cid) or isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
local oldVoc = getPlayerVocation(cid)
if(parameters.promotions[oldVoc] == oldVoc or parameters.promotions[oldVoc] == nil) then
npcHandler:say('You are already promoted!')
elseif(getPlayerLevel(cid) < parameters.level) then
npcHandler:say('I am sorry, but I can only promote you once you have reached level ' .. parameters.level .. '.')
elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
npcHandler:say('You do not have enough money!')
else
doPlayerSetVocation(cid, parameters.promotions[oldVoc])
npcHandler:say(parameters.text)
end
else
npcHandler:say('Sorry, only premium characters are allowed to be promoted.')
end
npcHandler:resetNpc()
return true
end