Ir para conteúdo

Featured Replies

Postado

Olá!

 

Estou precisando de algum script, ou algum jeito de quando o player comprar premium account (isPremium) ele receber a promotion junto.

A premium é fornecida por um npc, então eu quero que quando o jogador compre a premium account a promotion venha junto. Sendo assim:

 

Um knight vire um Elite knight 

Um druid vire um Elder druid

Um sorcerer vire um Master sorcerer

um paladin vire um Royal paladin

 

Script do npc:

 

days = 30
vipcoins = 3031
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('Obrigado, aqui estao seus 30 dias de Premium', cid)
else
npcHandler:say('Voce nao tem Coins suficientes!', cid)
end
end
npcHandler:resetNpc()
return true
end
end
npcHandler:setMessage(MESSAGE_GREET, "Ola. 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 = 'Voce gostaria de comprar 30 dias de Premium por 10 Coins?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())

 

Agradeço a atenção!  ;D 

Oi

Resolvido por Wakon

Ir para solução
  • Respostas 8
  • Visualizações 661
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • NPC: days = 30 vipcoins = 3031 quant = 10 local storage = 55885 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler)

  • Tenta assim, tira o que eu te passei do login.lua e coloca isso no lugar: if getPlayerStorageValue(cid, 55885) <= 0 and getPlayerPremiumDays(cid) >= 1 then setPlayerStorageValue(cid, 55885, 1)

Postado

O tópico foi movido para a área correta, preste mais atenção da próxima vez!

Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680

Este tópico foi movido:

De: "OTServSuporte OTServSuporte de OTServ Geral"

Para: "OTServSuporte OTServSuporte de Scripts"

 

 

Em relação ao seu pedido, tente assim:

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 days = 30
local vipcoins = 3031
local quant = 10

function santaNPC(cid, message, keywords, parameters, node)
	if not npcHandler:isFocused(cid) then
		return false
	end
	local premText = ""
	if parameters.present then
		if isPlayer(cid) then
			if getPlayerItemCount(cid, vipcoins) >= quant then
				doPlayerAddPremiumDays(cid, days)
				doPlayerRemoveItem(cid, vipcoins, quant)
				if getPlayerVocation(cid) < 5 then
					doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
					premText = " e sua Promotion."
				end
				npcHandler:say("Obrigado, aqui estao seus 30 dias de Premium" .. premText, cid)
			else
				npcHandler:say("Voce nao tem Coins suficientes!", cid)
			end
		end
		npcHandler:resetNpc()
		return true
	end
end

npcHandler:setMessage(MESSAGE_GREET, "Ola. 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 = 'Voce gostaria de comprar 30 dias de Premium por 10 Coins?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())

Atenciosamente,

Bruno Minervino

Postado

Ai tem esse post que fis de uma olhadinha

http://www.tibiaking.com/forum/topic/53268-premium-automatico-do-site-tutorial/

 

se te ajudei mi ajude dando um like ^^

 
 
se te ajudei mi ajude com um like
 
post-154810-0-74779100-1428114524_thumb.        post-154810-0-22067300-1428114531_thumb.          post-154810-0-83198200-1427326965.gif
post-154810-0-48855100-1429834735.gif
 
 
 
 
0 comentários:

 

Postado

NPC:

days = 30
vipcoins = 3031
quant = 10
local storage = 55885


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 and getPlayerVocation(cid) <= 4 and getPlayerVocation(cid) >= 1 then
doPlayerAddPremiumDays(cid,days)
doPlayerRemoveItem(cid,vipcoins,quant)
npcHandler:say('Obrigado, aqui estao seus 30 dias de Premium', cid)
doPlayerSendTextMessage(cid, 22, "Congratulations, you've been promoted..")
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
setPlayerStorageValue(cid, storage, 1)
elseif getPlayerItemCount(cid,vipcoins) >= quant and getPlayerVocation(cid) > 4 then
doPlayerAddPremiumDays(cid,days)
doPlayerRemoveItem(cid,vipcoins,quant)
npcHandler:say('Obrigado, aqui estao seus 30 dias de Premium', cid)
else
npcHandler:say('Voce nao tem Coins suficientes!', cid)
end
end
npcHandler:resetNpc()
return true
end
end
npcHandler:setMessage(MESSAGE_GREET, "Ola. 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 = 'Voce gostaria de comprar 30 dias de Premium por 10 Coins?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())

Vá em "Data/Creaturescripts/scripts" abra o login.lua e adicione o seguinte:

local vocstatus = getPlayerStorageValue(cid, 55885)
if vocstatus == 1 and getPlayerPremiumDays(cid) >= 1 then
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
return TRUE
end

Testei aqui e tá de boa, ele tira a promotion se estiver free, caso de algum bug me fale.

Postado
  • Autor

Ai tem esse post que fis de uma olhadinha

http://www.tibiaking.com/forum/topic/53268-premium-automatico-do-site-tutorial/

 

se te ajudei mi ajude dando um like ^^

 

Amigo, gostei do seu script e tudo mas não é exatamente o que eu quero. Quero um script que ao player comprar a premium seria adicionada automaticamente a promotion. :D

NPC:

days = 30
vipcoins = 3031
quant = 10
local storage = 55885


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 and getPlayerVocation(cid) <= 4 and getPlayerVocation(cid) >= 1 then
doPlayerAddPremiumDays(cid,days)
doPlayerRemoveItem(cid,vipcoins,quant)
npcHandler:say('Obrigado, aqui estao seus 30 dias de Premium', cid)
doPlayerSendTextMessage(cid, 22, "Congratulations, you've been promoted..")
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
setPlayerStorageValue(cid, storage, 1)
elseif getPlayerItemCount(cid,vipcoins) >= quant and getPlayerVocation(cid) > 4 then
doPlayerAddPremiumDays(cid,days)
doPlayerRemoveItem(cid,vipcoins,quant)
npcHandler:say('Obrigado, aqui estao seus 30 dias de Premium', cid)
else
npcHandler:say('Voce nao tem Coins suficientes!', cid)
end
end
npcHandler:resetNpc()
return true
end
end
npcHandler:setMessage(MESSAGE_GREET, "Ola. 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 = 'Voce gostaria de comprar 30 dias de Premium por 10 Coins?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())

Vá em "Data/Creaturescripts/scripts" abra o login.lua e adicione o seguinte:

local vocstatus = getPlayerStorageValue(cid, 55885)
if vocstatus == 1 and getPlayerPremiumDays(cid) >= 1 then
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
return TRUE
end

Testei aqui e tá de boa, ele tira a promotion se estiver free, caso de algum bug me fale.

 

Pelo que entendi o player compra a premium e também vem a promotion, e quando a premium acaba a promotion também acaba? Se for isso está perfeito, por que esqueci de citar no tópico pra quando a premium acabar a promotion também ser retirada  :facepalm:  Aqui não deu nenhum error amigo, está funcionando perfeitamente, mas só outra pergunta... Teria como colocar para todos personagens da conta ganharem promotion mesmo offline? 

Oi

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo