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