Ir para conteúdo

Featured Replies

Postado

Boa tarde! 

Desenvolvi um codigo para o comando !bless para meu projeto de servidor.

Testei alguns e não obtive sucesso, então gostaria de compartilhar para ajudar quem estiver com o mesmo problema.

 

Criei uma linha nova no arquivo talkactions.xml dentro da pasta Talkactions.

<talkaction words="!bless" script="bless.lua"/>

e criei um arquivo novo com o nome bless.lua na pasta scripts.

function onSay(cid)

	local player = Player(cid)
	local totalBlessPrice = getBlessingsCost(player:getLevel()) * 5 * 0.7
	
	if player:getBlessings() == 5 then
				player:sendCancelMessage("You already have been blessed!", cid)
			elseif player:removeMoney(totalBlessPrice) then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been blessed by all of eight gods!")
				for b = 1, 5 do
					player:addBlessing(b, 1)
				end
				player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
				
			else
				player:sendCancelMessage("You don't have enough money. You need " .. totalBlessPrice .. " to buy bless.", cid)
			end
end

O valor da bless poderá ser alterado conforme o gosto, basta trocar o 0.7 pelo valor desejado.

 

Espero ajudar!!

Abraço

  • Respostas 6
  • Visualizações 5.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.  

  • selenia.global
    selenia.global

    Fala Galera!!   Muito obrigado! no entanto, eles podem ser comprados na batalha, se o jogador pode comprar, como aquele que leva pz   Disculpa mim malo portuguese!   Che

  • selenia.global
    selenia.global

    @Cjaker I think I got it right this time!   Could you tell me if this passed the test/aproved?   function onSay(cid) local player = Player(cid) local totalBlessPrice = getB

Postado

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

Está faltando algumas funções amigo, verifique novamente para que ninguém tenha problema.

  • 2 weeks later...
Postado

Fala Galera!!

 

Muito obrigado! no entanto, eles podem ser comprados na batalha, se o jogador pode comprar, como aquele que leva pz :/

 

Disculpa mim malo portuguese!

 

Cheers from Norway :D!!

Hello everyone!!!

 

well i have keep on testing it yet i can’t find a correct way to do the solution to the script in order that players can’t buy blessings while on battle! 

 

It would be awesome if someone could help us out! 

 

getCost(getPlayerLevel(cid))
	if(not(isPlayerPzLocked(cid))) then

 

 

player:sendCancelMessage("You can't buy bless, when you are in a battle.")
	end

The community would be really thankfull!

 

 

 

 

Postado

@Cjaker I think I got it right this time!

 

Could you tell me if this passed the test/aproved?

 

function onSay(cid)

    local player = Player(cid)
    local totalBlessPrice = getBlessingsCost(player:getLevel()) * 5 * 0.7
    if(not(isPlayerPzLocked(cid))) then
    if player:getBlessings() == 5 then
                player:sendCancelMessage("You already have been blessed!", cid)
            elseif player:removeMoney(totalBlessPrice) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been blessed by all of eight gods!")
                for b = 1, 5 do
                    player:addBlessing(b, 1)
                end
                player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
                
            else
                player:sendCancelMessage("You don't have enough money. You need " .. totalBlessPrice .. " to buy bless.", cid)
            end
    else
        player:sendCancelMessage("You can't buy bless while you are in a battle.")
    end
end

Ok its working as requested, but now if(not(isPlayerPzLocked(cid)))  only does it so players CANT do it while having pz(pk) aka white skull...
how can i change that so it also works with if(not(isPlayer"in any combat"(not only pk)(cid))) 

Editado por selenia.global (veja o histórico de edições)

  • 1 year later...
Postado

Opa, esse foi o unico script que funcionou no meu, fiz alguns ajsutes.. 

Mas enfim tem um erro. Ele funciona o player recebe a bless certinho mas não esta cobrando nada sabe... não esta descontando o dinheiro..

 

tinha funções faltando na sua script, ja arrumei. Obrigado.

Editado por dougotserv (veja o histórico de edições)

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