Ir para conteúdo
  • Cadastre-se

(Resolvido)[AJUDA][talkactions] Como se adiciona para cobrar na viajem !fly


Ir para solução Resolvido por 9k22,

Posts Recomendados

Boa noite, Pessoal 
Gostaria de adicionar um custo para usar o comando !fly nas localidades a baixo 

exemplo: 


Carlin = R$: 100 Gold
(msg: você nao tem dinheiro para viajar)  > o player nao tem dinheiro para viajar


Venore = R$: 100 Gold
(tendo o gold ! -> o player vai até o destino referente as coordenadas a baixo são de um mapa de teste. 

 

 

(Será que podem me ajudar?)

 

 

Carlin = {x= 150, y= 150, z= 7}
Thais = {x= 141, y= 150, z= 7}
Venore = {x= 158, y= 150, z= 7}

 

function onSay(cid, words, param, channel)

local days = getPlayerPremiumDays(cid)

 if   days == 0 or days <= 1 
     then
          doPlayerSendCancel(cid, 'Necessário premium account pra poder usar o Fly.')
               end

        if getTilePzInfo(getPlayerPosition(cid)) then

                        if (param == 'Thais') then
                        doTeleportThing(cid, Thais)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Carlin') then
                        doTeleportThing(cid, Carlin)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        

                        elseif (param == 'Venore') then
                        doTeleportThing(cid, Venore)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        else
                        local str = "(Carlin , Thais , Venore) "
                        doShowTextDialog(cid, 2160, str)
                        end

        else
        doPlayerSendCancel(cid, "Voce so pode em area pz.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end


end

Editado por Gordongordon (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução
2 horas atrás, login12 disse:

Quando eu entrar se ngm tiver feito, eu faço

Enviado de meu SM-J105B usando Tapatalk
 

Q viado vc é HUIEWHUIEHWUI

Vou fazer para ele, meu mestre HUEHEUHEUHEUHEUHE

 

 

Carlin = {x= 150, y= 150, z= 7}
Thais = {x= 141, y= 150, z= 7}
Venore = {x= 158, y= 150, z= 7}

valor_carlin = 100
valor_thais = 100
valor_venore = 100
function onSay(cid, words, param, channel)
local days = getPlayerPremiumDays(cid)
if days == 0 or days <= 1 
     then
          doPlayerSendCancel(cid, 'Necessário premium account pra poder usar o Fly.')
               end
        if getTilePzInfo(getPlayerPosition(cid)) then
                        if (param == 'Thais') then
                        if getPlayerMoney(cid) >= 1 then -- checa money
                        doPlayerRemoveMoney(cid, valor_thais) -- remove money
                        doTeleportThing(cid, Thais)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        elseif (param == 'Carlin') then
                        if getPlayerMoney(cid) >= 1 then -- checa money
                        doPlayerRemoveMoney(cid, valor_carlin) -- remove money
                        doTeleportThing(cid, Carlin)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        elseif (param == 'Venore') then
                        if getPlayerMoney(cid) >= 1 then -- checa money
                        doPlayerRemoveMoney(cid, valor_venore) -- remove money
                        doTeleportThing(cid, Venore)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        else
                        local str = "(Carlin , Thais , Venore) "
                        doShowTextDialog(cid, 2160, str)
                        end
        else
        doPlayerSendCancel(cid, "Voce so pode em area pz.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end

end

 

Editado por Subyth (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
20 minutos atrás, Subyth disse:

Q viado vc é HUIEWHUIEHWUI

Vou fazer para ele, meu mestre HUEHEUHEUHEUHEUHE

 

 

Carlin = {x= 150, y= 150, z= 7}
Thais = {x= 141, y= 150, z= 7}
Venore = {x= 158, y= 150, z= 7}

valor_carlin = 100
valor_thais = 100
valor_venore = 100
function onSay(cid, words, param, channel)
local days = getPlayerPremiumDays(cid)
if days == 0 or days <= 1 
     then
          doPlayerSendCancel(cid, 'Necessário premium account pra poder usar o Fly.')
               end
        if getTilePzInfo(getPlayerPosition(cid)) then
                        if (param == 'Thais') then
                        if getPlayerMoney(cid) >= 1 then -- checa money
                        doPlayerRemoveMoney(cid, valor_thais) -- remove money
                        doTeleportThing(cid, Thais)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        elseif (param == 'Carlin') then
                        if getPlayerMoney(cid) >= 1 then -- checa money
                        doPlayerRemoveMoney(cid, valor_carlin) -- remove money
                        doTeleportThing(cid, Carlin)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        elseif (param == 'Venore') then
                        if getPlayerMoney(cid) >= 1 then -- checa money
                        doPlayerRemoveMoney(cid, valor_venore) -- remove money
                        doTeleportThing(cid, Venore)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        else
                        local str = "(Carlin , Thais , Venore) "
                        doShowTextDialog(cid, 2160, str)
                        end
        else
        doPlayerSendCancel(cid, "Voce so pode em area pz.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end

end

 

 

 

 

Você só esqueceu de arrumar aqui:

 if getPlayerMoney(cid) >= 1 then -- checa money

Devia utilizar ai a variavel que você registrou la em cima, ficando assim:

 if getPlayerMoney(cid) >= valor_thais then -- checa money

 

 

Arruma aí em todas as citys pro guri D:

 

@This life is filled with hurt

When happiness doesn't work

Trust me and take my hand

When the lights go out you will understand

Link para o post
Compartilhar em outros sites

AAlá '-'

 

Carlin = {x= 150, y= 150, z= 7}
Thais = {x= 141, y= 150, z= 7}
Venore = {x= 158, y= 150, z= 7}
valor_carlin = 100
valor_thais = 100
valor_venore = 100
function onSay(cid, words, param, channel)
local days = getPlayerPremiumDays(cid)
if days == 0 or days <= 1 
     then
          doPlayerSendCancel(cid, 'Necessário premium account pra poder usar o Fly.')
               end
        if getTilePzInfo(getPlayerPosition(cid)) then
                        if (param == 'Thais') then
                        if getPlayerMoney(cid) >= valor_thais then -- checa money
                        doPlayerRemoveMoney(cid, valor_thais) -- remove money
                        doTeleportThing(cid, Thais)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        elseif (param == 'Carlin') then
                        if getPlayerMoney(cid) >= valor_carlin then -- checa money
                        doPlayerRemoveMoney(cid, valor_carlin) -- remove money
                        doTeleportThing(cid, Carlin)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        elseif (param == 'Venore') then
                        if getPlayerMoney(cid) >= valor_venore then -- checa money
                        doPlayerRemoveMoney(cid, valor_venore) -- remove money
                        doTeleportThing(cid, Venore)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        else
                        local str = "(Carlin , Thais , Venore) "
                        doShowTextDialog(cid, 2160, str)
                        end
        else
        doPlayerSendCancel(cid, "Voce so pode em area pz.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
end

 ta ae

 

Editado por Subyth (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
1 hora atrás, Riisezor disse:

Para para usar em tfs 1.x ?

nao consigo achar um para tfs 1.x e nao consigo fazer..

 

 

Aqui,

local cidades = {
	["carlin"] = Position(150, 150, 7),
	["thais"] = Position(141, 150, 7),
	["venore"] = Position(158, 150, 7)
}
function onSay(player, words, param)
	
	local param = param:lower()
	local minPremium = 1 -- Quantidade minima de premium para utilizar.
	
	if player:getPremiumDays() < minPremium  then
		player:sendCancelMessage("You need premium account to use fly system.")
	end
	
	if Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
		if cidades[param] then
			player:teleportTo(cidades[param])
			player:sendMagicEffect(10)
		else
			local str = "Carlin , Thais , Venore"
			player:ShowTextDialog(2160, str)
		end
	else
		player:sendCancelMessage("Sorry, you need be in protection zone for use this.")
		player:sendMagicEffect(CONST_ME_POFF)
	end
	return true
end

 

 

Para adicionar mais cidades, adicione na tabela. Exemplo:

["yalahar"] Position(x,y,z)

Não esqueça de manter a virgula sempre na ultima tabela.

 

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

 

@This life is filled with hurt

When happiness doesn't work

Trust me and take my hand

When the lights go out you will understand

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo