NPC:
local config = {
days = 30,
vipcoins = 2145,
quant = 10,
prom_lv = 2 --Nível da promoção.
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if isPlayer(cid) then
if getPlayerItemCount(cid, config.vipcoins) >= config.quant then
doPlayerAddPremiumDays(cid, config.days)
doPlayerSetPromotionLevel(cid, config.prom_lv)
doPlayerRemoveItem(cid, config.vipcoins, config.quant)
npcHandler:say('Certa, aqui estᡳeus dias de Premium', cid)
else
npcHandler:say('Voce n䯠tem "..config.quant.." diamentes.', cid)
end
end
npcHandler:resetNpc()
return true
end
end
npcHandler:setMessage(MESSAGE_GREET, "OlPLAYERNAME|. Eu vendo dias de {Premium}.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'premium'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Vocꡧostaria de comprar 30 dias de Premium por 10 diamantes?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
local prom_lv, toPos = 2, {x = x, y = y, z = z} --Respectivamente, nível da promoção e posição para onde o jogador será teleportado quando a premium acabar.
function onLogin(cid)
local prem_days = getPlayerPremiumDays(cid)
if prem_days > 0 and getPlayerPromotionLevel(cid) ~= prom_lv then
doPlayerSetPromotionLevel(cid, prom_lv)
elseif prem_days == 0 and getPlayerPromotionLevel(cid) == prom_lv then
doPlayerSetPromotionLevel(cid, prom_lv - 1)
doTeleportThing(cid, toPos)
end
return true
end<event type="login" name="checkVocationPremium" event="script" value="nome_do_arquivo.lua"/>






info
Grupo: Campones
Registrado: 11/09/15
Posts: 48
Reputação: +2
Iae
Bom, tenho um script de um npc que vende premium account por diamonds para tibia 8.60, mas esse script precisa de umas modificações para ficar bom! Eu não sei faze-las, então espero que alguém me ajude
Aqui o script:
days = 30 vipcoins = 2145 quant = 10 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 function santaNPC(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (parameters.present == true) then if isPlayer(cid) then if getPlayerItemCount(cid,vipcoins) >= quant then doPlayerAddPremiumDays(cid,days) doPlayerRemoveItem(cid,vipcoins,quant) npcHandler:say('Certa, aqui estᡳeus dias de Premium', cid) else npcHandler:say('Voce n䯠tem "..quant.." diamentes.', cid) end end npcHandler:resetNpc() return true end end npcHandler:setMessage(MESSAGE_GREET, "OlPLAYERNAME|. Eu vendo dias de {Premium}.") local noNode = KeywordNode:new({'no'}, santaNPC, {present = false}) local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true}) local node = keywordHandler:addKeyword({'premium'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Vocꡧostaria de comprar 30 dias de Premium por 10 diamantes?'}) node:addChildKeywordNode(yesNode) node:addChildKeywordNode(noNode) npcHandler:addModule(FocusModule:new())Eu queria que logo após o player falar "yes" para trocar os diamantes por dias de premium automaticamente o npc adicionasse promotion, e quando a premium acabasse a promotion também acabasse.
E também uma dúvida, tem algum jeito do player não precisar relogar a conta para que a premium comece a validar?
Rep +
obrigado!