Talkaction /ir x

daniell99
em Scripts

daniell99

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/18Posts: 4Gênero: Masculino

Preciso de um Talkaction que quando o player falar /ir "lugar" ele seja teleportado para a posição configurada dentro do script, e gostaria de poder configurar vários lugares dentro do mesmo script ex: /ir Thais, /ir venore. E que eu podesse configurar se ele precisa ser premiun pra ir pra certo lugar ou não e que dependo do lugar fosse cobrado um valor pra ser teleportado.... Mas quero essas configurações individuais pra cada lugar se por possível alguém da um help

 

 

Uso tfs 1.3

 

 

M i s s

Merascylla
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/05/18Posts: 267Gênero: FemininoChar no Tibia: Merascylla
Spoiler
local positions = {

    {lugar = "Midgard", pos = {x=123, y=123, z=7}, price = 1000}, -- Nome do lugar, posicao do lugar

    {lugar = "Sao Paulo", pos = {x=123, y=123, z=7}, price = 13000},

    {lugar = "Carlin", pos = {x=123, y=123, z=7}, price = 1000},

    {lugar = "Venore", pos = {x=123, y=123, z=7}, price = 1000}

}




local needPz = false -- Precisa de pz? [true/false]

local cooldown = 5 -- Tempo em segundos para poder se teleportar novamente.

local needPrem = false --  Precisa ser premiu? [true/false]


function onSay(cid, words, param, channel)


    local str = ""


    for i = 1, (#positions) do

        local cidades = positions[i].lugar

        local custo = positions[i].price

        str = str .. cidades .. ' - ' .. custo .. ' gps\n '

    end


    if param == "" then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Para se teleportar diga !teleport LUGAR.\nLugares disponiveis:\n " .. str .. " \n Escolha seu destino e boa viagem!")

    end


    for _, abc in pairs(positions) do


        if param:lower() == abc.lugar:lower() then


            if needPz == true and getTilePzInfo(getCreaturePosition(cid)) == false then

                return doPlayerSendCancel(cid, "Voce precisa estar em PZ para teleportar.")

            elseif getPlayerStorageValue(cid, 23121) > os.time() then

                return doPlayerSendCancel(cid, "Voce deve esperar mais " .. getPlayerStorageValue(cid, 23121) - os.time() .. " segundos para se teleportar novamente.")

            elseif needPrem == true and not isPremium(cid) then

                return doPlayerSendCancel(cid, "Somente jogadores premium podem teleportar.")

            elseif getPlayerMoney(cid) < abc.price then

                return doPlayerSendCancel(cid, "Voce nao tem dinheiro.")      

            end


            doPlayerSetStorageValue(cid, 23121, os.time() + cooldown)

            doPlayerRemoveMoney(cid, abc.price)

            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

            doTeleportThing(cid, abc.pos)

            doPlayerSendTextMessage(cid, 25, "Bem vindo a " .. abc.lugar.. "!")

            doSendMagicEffect(abc.pos, CONST_ME_TELEPORT)

        end

    end

    return true

end

Créditos: Killua