Ir para conteúdo
  • 0

[Pedido] Promotion Npc


Adolfohrq

Pergunta

É possível criar um npc que venda a promotion 2 para o jogador que possuir dias premium e ao mesmo tempo vendes aos jogadores de contas free a promotion 1? Caso o jogador não possua premium ele não poderá comprar a segunda premium, somente a primeira...

 

 

 

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

 

local node1 = keywordHandler:addKeyword({'promote'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, 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, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

 

local node2 = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 50000, level = 20, premium = true, promotion = 2, text = 'Parabens meu jovem, voce adquiriu

 

a promotion VIP'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce ja tem a promotion vip', reset = true})

 

npcHandler:addModule(FocusModule:new())

 

Tentei essa seguinte operação, porém os jogadores free também estão podendo comprar a segunda promotion!

Link para o comentário
Compartilhar em outros sites

7 respostass a esta questão

Posts Recomendados

  • 0

Sim, muito estranho.. Eles podem comprar sim :S

 

Dei uma mechida no script e ainda assim os free's podem comprar a promotion 2

 

 

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

 

local node1 = keywordHandler:addKeyword({'promote'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, 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, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

 

local node2 = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, text = 'I can promote you for 50000 gold coins. Do you want me to promote you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 50000, level = 20, promotion = 2, premium = true, text = 'Parabens meu jovem, voce adquiriu a promotion VIP'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce ja tem a promotion vip', reset = true})

 

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

eu testei aqui e funfou '-'

 

13:30 Mister [94]: vip

13:30 Ludger: I can promote you for 50000 gold coins. Do you want me to promote you?

13:30 Mister [94]: yes

13:30 Ludger: You need a premium account in order to get promoted.

13:31 Ludger: Ate logo mais Mister.

 

se pá eu posso fazer um npc pra vc tal

Link para o comentário
Compartilhar em outros sites

  • 0

n sei

 

testa

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
local promote = {
["promote"] = {level = 20, price = 20000, promotion = 1, premium = false},
["vip"] = {level = 20, price = 50000, promotion = 2, premium = true}
} 
if promote[msg] then
if promote[msg].premium == true and not isPremium(cid) then
npcHandler:say('You need a premium account in order to get promoted', cid)
return true
end
if getPlayerPromotionLevel(cid) < promote[msg].promotion then
if getPlayerLevel(cid) >= promote[msg].level then
if doPlayerRemoveMoney(cid, promote[msg].price) then
setPlayerPromotionLevel(cid, promote[msg].promotion)
npcHandler:say('Congratulations! You are now promoted!', cid)
else
npcHandler:say('You need '..promote[msg].price..' gps to buy this promotion.', cid)
end
else
npcHandler:say('I am sorry, but I can only promote you once you have reached level '..promote[msg].level, cid)
end
else
npcHandler:say('You are already promoted!', cid)
end
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

testei esse script e funcionou no meu servidor, porem eu gostaria de saber se teria como mudar um pouco, tpw pro player poder comprar a segunda promotion ele deveria ter a primera, ali no caso tu compra a segunda msm não estando com a primera promotion ele promove igal, queria uma que o player teria que comprar a primera para dps poder comprar a segunda...

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...