n é mais facil teleporta pra x position ñ ? ;x
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330

info
Grupo: Campones
Registrado: 03/05/08
Posts: 4
Reputação: 0
Char no Tibia: Titiof

Pode ser para uma posição qualquer, eu depois mudo para a posição que precisar, eu disse !go depot como exemplo, eu preciso é que me limite a não poder usar quando tiver pz battle (atacado players com ou sem skull)
script.lua:
local to = {
['depot'] = {x=1058,y=1066,z=7},
['templo'] = {x=1063,y=1067,z=7},
}
function onSay(cid, words, param, channel)
local p = param:lower()
if getCreatureCondition(cid,CONDITION_INFIGHT) == false then
if to[p] ~= nil then
doTeleportThing(cid,to[p])
doSendMagicEffect(to[p],10)
doPlayerSendTextMessage(cid,4,"Teleportado ao "..p..".")
else
doPlayerSendTextMessage(cid,4,"Local inválido.")
end
else
doPlayerSendTextMessage(cid,4,"Use sem battle.")
end
return true
end
<talkaction words="!go" event="script" value="script.lua"/>
Assim?
Editado Fevereiro 15 por 20cm
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

doPlayerSendTextMessage(cid,4,"Teleportado ao "..to[p]..".")
isso n vai dar nil? -ou vai retornar o id da tabela-
doPlayerSendTextMessage(cid,4,"Teleportado ao "..to[p]..".")
isso n vai dar nil? -ou vai retornar o id da tabela-
Boa, arrumei.
info
Grupo: Campones
Registrado: 03/05/08
Posts: 4
Reputação: 0
Char no Tibia: Titiof

Não entendi o que estava mal
Como assim? Usa esse script:
local to = {
['depot'] = {x=1058,y=1066,z=7},
['templo'] = {x=1063,y=1067,z=7},
}
function onSay(cid, words, param, channel)
local p = param:lower()
if getCreatureCondition(cid,CONDITION_INFIGHT) == false then
if to[p] ~= nil then
doTeleportThing(cid,to[p])
doSendMagicEffect(to[p],10)
doPlayerSendTextMessage(cid,4,"Teleportado ao "..p..".")
else
doPlayerSendTextMessage(cid,4,"Local inválido.")
end
else
doPlayerSendTextMessage(cid,4,"Use sem battle.")
end
return true
end
se funcionou avisa e da rep+ por recompensa...
Editado Fevereiro 15 por 20cm
info
Grupo: Campones
Registrado: 03/05/08
Posts: 4
Reputação: 0
Char no Tibia: Titiof

Funcionou, muito obrigado!!!!
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

reportado para ser movido.
Oooi me ajuda aki pf...
Tem como colocar um "wait" de 10 segundos para poder usar essa talkactions novamente?
function onSay(cid, words, param)
local config = {
pz = false, -- players precisam estar em protection zone para usar? (true or false)
battle = true, -- players deve estar sem battle (true or false)
custo = true, -- se os teleport irão custa (true or false)
need_level = true, -- se os teleport irão precisar de level (true or false)
premium = true -- se precisa ser premium account (true or false)
}
--[[ Config lugares]]--
local lugar = {
["templo"] = { -- nome do lugar
pos = {x = 7999, y = 7992, z = 7},level = 10, price = 000},
["arena"] = { -- nome do lugar
pos = {x=24900, y=24965, z=7},level = 15,price = 000},
["tps"] = { -- nome do lugar
pos = {x=24992, y=24829, z=5},level = 15,price = 000},
["vip"] = { -- nome do lugar
pos = {x=25089, y=25362, z=7},level = 15,price = 000},
["treiner"] = { -- nome do lugar
pos = {x=24999, y=25383, z=6},level = 15,price = 000},
["quests"] = { -- nome do lugar
pos = {x=25024, y=24852, z=7},level = 15,price = 000},
}
--[[ Lista de Viagem (Não mexa) ]]--
if (param == "lista") then
local str = ""
str = str .. "lista de viagem :\n\n"
for name, pos in pairs(lugar) do
str = str..name.."\n"
end
str = str .. ""
doShowTextDialog(cid, 6579, str)
return TRUE
end
local a = lugar[param]
if not(a) then
doPlayerSendTextMessage(cid, 22, "desculpe,este lugar não existe")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"você precisa estar em protection zone pra poder teleportar.")
return TRUE
elseif config.premium == true and not isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Apenas players com premium account podem teleportar.")
return TRUE
elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você precisa estar sem battler pra poder teleportar.")
return TRUE
elseif config.need_level == true and getPlayerLevel(cid) < a.level then
doPlayerSendTextMessage(cid, 22, "Desculpe,Voce não tem level. voce precisa "..a.level.." level ou mais para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.custo == true and doPlayerRemoveMoney(cid, a.price) == FALSE then
doPlayerSendTextMessage(cid, 22, "Desculpe,voce nao tem dinheiro suficiente. Voce precisa "..a.price.." gp para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
doTeleportThing(cid, a.pos)
doSendMagicEffect(a.pos, CONST_ME_TELEPORT)
doBroadcastMessage("" .. getPlayerName(cid) .. " foi teleportado para: " .. param .. ".Usando /fly", 25)
return TRUE
end
Editado Fevereiro 18 por Lucasyeah
info
Grupo: Infante
Registrado: 04/03/11
Posts: 1.6k
Reputação: +393
Char no Tibia: No Have

Tópico movido para a seção de dúvidas e pedidos resolvidos.
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

@Lucas .
function onSay(cid, words, param)
local config = {
pz = false, -- players precisam estar em protection zone para usar? (true or false)
battle = true, -- players deve estar sem battle (true or false)
custo = true, -- se os teleport irão custa (true or false)
need_level = true, -- se os teleport irão precisar de level (true or false)
premium = true, -- se precisa ser premium account (true or false)
s = 11548, -- n mexa
exhau = 10 -- tempo em seegundos para salvar denovo
}
--[[ Config lugares]]--
local lugar = {
["templo"] = { -- nome do lugar
pos = {x = 7999, y = 7992, z = 7},level = 10, price = 000},
["arena"] = { -- nome do lugar
pos = {x=24900, y=24965, z=7},level = 15,price = 000},
["tps"] = { -- nome do lugar
pos = {x=24992, y=24829, z=5},level = 15,price = 000},
["vip"] = { -- nome do lugar
pos = {x=25089, y=25362, z=7},level = 15,price = 000},
["treiner"] = { -- nome do lugar
pos = {x=24999, y=25383, z=6},level = 15,price = 000},
["quests"] = { -- nome do lugar
pos = {x=25024, y=24852, z=7},level = 15,price = 000},
}
--[[ Lista de Viagem (Não mexa) ]]--
if (param == "lista") then
local str = ""
str = str .. "lista de viagem :\n\n"
for name, pos in pairs(lugar) do
str = str..name.."\n"
end
str = str .. ""
doShowTextDialog(cid, 6579, str)
return TRUE
end
local a = lugar[param]
if not(a) then
doPlayerSendTextMessage(cid, 22, "desculpe,este lugar não existe")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"você precisa estar em protection zone pra poder teleportar.")
return TRUE
elseif config.premium == true and not isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Apenas players com premium account podem teleportar.")
return TRUE
elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você precisa estar sem battler pra poder teleportar.")
return TRUE
elseif config.need_level == true and getPlayerLevel(cid) < a.level then
doPlayerSendTextMessage(cid, 22, "Desculpe,Voce não tem level. voce precisa "..a.level.." level ou mais para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.custo == true and doPlayerRemoveMoney(cid, a.price) == FALSE then
doPlayerSendTextMessage(cid, 22, "Desculpe,voce nao tem dinheiro suficiente. Voce precisa "..a.price.." gp para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif getPlayerStorageValue(cid, config.s) > os.time() then
doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar o comando novamente.")
return TRUE
end
setPlayerStorageValue(cid, config.s, config.exhau + os.time())
doTeleportThing(cid, a.pos)
doSendMagicEffect(a.pos, CONST_ME_TELEPORT)
doBroadcastMessage("" .. getPlayerName(cid) .. " foi teleportado para: " .. param .. ".Usando /fly", 25)
return TRUE
end
Editado Fevereiro 18 por SkyLigh
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

isso ta errado n? ![]()
elseif (getPlayerStorageValue(cid, config.s) <= os.time()) then setPlayerStorageValue(cid,config.s,os.time()+config.exhau) doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar o comando novamente.") return TRUE end
certo seria algu como...
elseif getPlayerStorageValue(cid, config.s) > os.time() then doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar o comando novamente.") return TRUE end setPlayerStorageValue(cid, config.s, config.exhau + os.time())





info
Grupo: Campones
Registrado: 03/05/08
Posts: 4
Reputação: 0
Char no Tibia: Titiof
Eu preciso uma talkaction que quando eu fale, por ex: !go depot, eu sou teletransportado para o depot mas se eu tiver pz battle ela não me teletransporta. Alguém me ajude sff.