Ir para conteúdo
  • 0

Duvida Com Teleport


neroxp

Pergunta

Bom pra começar eu peguei o script de /t do god e copiei assim os player fala /t nome da cidade ele teleporta normal

mas encontrei um pobleminha nisso eu quero por ele pra teleporta pra quando ele estiver em uma pz zone imagina os kra no pipoko morrendo usa esse comando fica meio chato neh

 

bom vamos ao script

 

 

function onSay(cid, words, param, channel)

local master = false

if(words == '/t') then

master = true

elseif(param == '') then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")

return true

end

local tid, t = cid, string.explode(param, ",")

if(t[(master and 1 or 2)]) then

tid = getPlayerByNameWildcard(t[(master and 1 or 2)])

if(not tid or (isPlayerGhost(tid) and getPlayerAccess(tid) > getPlayerAccess(cid))) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[(master and 1 or 2)] .. " not found.")

return true

end

end

local tmp = getPlayerTown(cid)

if(not master) then

tmp = t[1]

if(not tonumber(tmp)) then

tmp = getTownId(tmp)

if(not tmp) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")

return true

end

end

end

local pos = getTownTemplePosition(tmp, false)

if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")

return true

end

pos = getClosestFreeTile(tid, pos)

if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")

return true

end

tmp = getCreaturePosition(tid)

if(doTeleportThing(tid, pos) and not isPlayerGhost(tid)) then

doSendMagicEffect(tmp, CONST_ME_HITAREA)

doSendMagicEffect(pos, CONST_ME_BATS)

end

return true

end

 

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

kra eu tenho uma talkaction de tp bem lgl aqui e facil de configurar, quem sabe vc goste.

créditos: VodKart.

function onSay(cid, words, param)

local config = {
exhaustionInSeconds = 1800, -- exausted em segundos.
storage = 34534,
pz = "no", -- players precisam estar em protection zone para usar? ("yes" or "no").
battle = "no", -- players deve estar sem battle ("yes" or "no")
custo = "no", -- se os teleport irão custa ("yes" or "no")
premium = "no" -- se precisa ser premium account ("yes" or "no")
}

-------------Config Lugares----------------
local lugar = {
["sul"] = {{x=2461, y=2419, z=7}, 1, 2000}, -- nome da city, posição, lvl minimo, preço em gps.
["west"] = {{x=2269, y=2264, z=7}, 10, 1000},
["east"] = {{x=2997, y=2163, z=7}, 1, 2000},
["nort"] = {{x=2531, y=1726, z=7}, 1, 2000},
["center"] = {{x=2577, y=2086, z=7}, 1, 2000}
}
-------------/Config Checkar não mecha----------------
local lugar = lugar[param]
if (param == "check") then
for name, pos in pairs(lugar) do
text = "Destination: "..name..", Level required: "..pos[2]..","
if(config.battle == "yes") then
text = text.." You can use while fighting: Yes"
else
text = text.." You can use while fighting: No"
end
if(config.pz == "yes") then
text = text.." You should use in protection zone: Yes"
else
text = text.." You should use in protection zone: No"
end
if (pos[3] == TRUE) then
text = text..", Cost: "..pos[4]..";"
end
doPlayerSendTextMessage(cid, 20, ""..text.."")
end
return TRUE
end

if(exhaustion.check(cid, config.storage) == TRUE) then
  if (exhaustion.get(cid, 34534) >= 60) then
  doPlayerSendCancel(cid, "You can only teleport after [" .. math.floor(exhaustion.get(cid, 34534) / 60 + 1) .."] minutes.")
  end
if (exhaustion.get(cid, 34534) <= 60) then
doPlayerSendCancel(cid, "You can only teleport after [" .. exhaustion.get(cid, 34534).."] seconds.")
end
return TRUE
end

if(config.pz == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"You should be in the protection zone for use.")
return TRUE
end

if(config.premium == "yes") and (not isPremium(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Only players with premium account can use.")
return TRUE
end

if(config.battle == "yes") and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not use in battle.")
return TRUE
end

if not(lugar) then
doPlayerSendTextMessage(cid, 22, "Sorry, this place does not exist.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end

if (getPlayerLevel(cid) <= lugar[2]) then
doPlayerSendTextMessage(cid, 22, "Sorry, you don't have level. You need "..lugar[2].." level or more to be teleported.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end


if(config.custo == "yes") and (doPlayerRemoveMoney(cid, lugar[3]) == FALSE) then
doPlayerSendTextMessage(cid, 22, "Sorry, you do not have enough money. You need "..lugar[3].." golds to be teleported.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
doTeleportThing(cid, lugar[1])
doSendMagicEffect(lugar[1], 46)
doPlayerSendTextMessage(cid, 22, "" .. getPlayerName(cid) .. " was teleported to: " .. param .. ".")
return TRUE
end

Editado por Jhon992
Link para o comentário
Compartilhar em outros sites

  • 0

onde eu coloco isso ?

 

 

if(isPlayerPzLocked(cid) == true) then

return doPlayerSendCancel(cid, "Você não pode teleportar em combate!.")

end

Link para o comentário
Compartilhar em outros sites

  • 0

Seu Script so pra players sem Battle usar

 

 


function onSay(cid, words, param, channel)
local master = false
if(words == '/t') then
master = true
elseif(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local tid, t = cid, string.explode(param, ",")
if(t[(master and 1 or 2)]) then
tid = getPlayerByNameWildcard(t[(master and 1 or 2)])
if(not tid or (isPlayerGhost(tid) and getPlayerAccess(tid) > getPlayerAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[(master and 1 or 2)] .. " not found.")
return true
end
end
local tmp = getPlayerTown(cid)
if(not master) then
tmp = t[1]
if(not tonumber(tmp)) then
tmp = getTownId(tmp)
if(not tmp) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
return true
end
end
end
local pos = getTownTemplePosition(tmp, false)
if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
return true
end
pos = getClosestFreeTile(tid, pos)
if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
return true
end
tmp = getCreaturePosition(tid)
if(doTeleportThing(tid, pos) and not isPlayerGhost(tid)) and getTilePzInfo(getThingPos(cid)) == TRUE then
doSendMagicEffect(tmp, CONST_ME_HITAREA)
doSendMagicEffect(pos, CONST_ME_BATS)
else
doPlayerSendCancel(cid, "Você não pode teleportar Fora de pz zone!.")
end
return true
end

 

Editado por mulizeu
Link para o comentário
Compartilhar em outros sites

  • 0

function onSay(cid, words, param, channel)
local master = false
if(words == '/t') then
master = true
elseif(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local tid, t = cid, string.explode(param, ",")
if(t[(master and 1 or 2)]) then
tid = getPlayerByNameWildcard(t[(master and 1 or 2)])
if(not tid or (isPlayerGhost(tid) and getPlayerAccess(tid) > getPlayerAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[(master and 1 or 2)] .. " not found.")
return true
end
end
local tmp = getPlayerTown(cid)
if(not master) then
tmp = t[1]
if(not tonumber(tmp)) then
tmp = getTownId(tmp)
if(not tmp) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
return true
end
end
end
local pos = getTownTemplePosition(tmp, false)
if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
return true
end
pos = getClosestFreeTile(tid, pos)
if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
r[font=arial,helvetica,sans-serif]e[size=4]turn true
end
if(isPlayerPzLocked(cid) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot teleport while in battle.")
return true
end
tmp = getCreaturePosition(tid)
if(doTeleportThing(tid, pos) and not isPlayerGhost(tid)) then
doSendMagicEffect(tmp, CONST_ME_HITAREA)
doSendMagicEffect(pos, CONST_ME_BATS)
end
return true
end

 

Tente esse.

Editado por Valentine
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...