NPC não reconhece premium, memso com premium ele fala que o jogador precisa de premium para comprar promotion, e nem até os npcs do barco mandam todos os players pra qualquer cidade, ate os free.
-- 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())
Modules.lua:
--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
info
Grupo: Campones
Registrado: 09/07/15
Posts: 37
Reputação: +14
Gênero: Masculino
-- Premium account freePremium = false premiumForPromotion = true removePremiumOnInit = true-- 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())--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 endninguem? =(