Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

TFS 1.3

Qual o motivo deste tópico? 

Preciso converter esse Script TFS 0.4 para 1.3 e estou sem tempo pra estudar e ver as funções do 0.4 para 1.3

Um comando muito útil para ver alterações no mapa ou possíveis bugs.

 

Segue o Script:

 

 

 

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

 

 

Você tem o código disponível? Se tiver publique-o aqui: 


 

 

teleportsend.lua

  • 2 weeks later...
Postado
  • Diretor
function onSay(cid, words, param, channel)
    if param == '' then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
        return true
    end

    local t = string.explode(param, ";")
    if not t[2] then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No destination specified.")
        return true
    end

    local pid = getPlayerByName(t[1])
    if not pid or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
        return true
    end

    local creature = getCreatureByName(t[2])
    local player = getPlayerByName(t[2])
    local waypoint = getWaypointPosition(t[2])
    local tile = string.explode(t[2], ",")
    local pos = {x = 0, y = 0, z = 0}

    if player and (not isPlayerGhost(player) or getPlayerAccess(player) <= getPlayerAccess(cid)) then
        pos = getCreaturePosition(player)
    elseif creature and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerAccess(creature) <= getPlayerAccess(cid))) then
        pos = getCreaturePosition(creature)
    elseif type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0 then
        pos = waypoint
    elseif tile[2] and tile[3] then
        pos = {x = tonumber(tile[1]), y = tonumber(tile[2]), z = tonumber(tile[3])}
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid destination specified.")
        return true
    end

    if not pos or isInArray({pos.x, pos.y}, 0) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
        return true
    end

    pos = getClosestFreeTile(cid, pos)
    if not pos or isInArray({pos.x, pos.y}, 0) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
        return true
    end

    local tmp = getCreaturePosition(pid)
    if doTeleportThing(pid, pos, true) and not isPlayerGhost(pid) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
    end

    return true
end

 

Postado

Eu testei esse script e funcionou bem. Não tenho certeza se o seu TFS 1.3 tem o revscript...

local talk = TalkAction("/send", "!send")

function talk.onSay(player, words, param)
    if not player:getGroup():getAccess() then return true end
  local split = param:split(",")
  if split[4] then
    local p = Player(split[1])
    if p then
      p:teleportTo(Position(split[2], split[3], split[4]))
      p:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    end
  end
  return false
end

talk:separator(" ")
talk:register()

exemplo:
/send player name, 33321, 33322, 7

Postado
  • Autor
Em 18/07/2023 em 04:11, L3K0T disse:

function onSay(cid, words, param, channel)
    if param == '' then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
        return true
    end

    local t = string.explode(param, ";")
    if not t[2] then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No destination specified.")
        return true
    end

    local pid = getPlayerByName(t[1])
    if not pid or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
        return true
    end

    local creature = getCreatureByName(t[2])
    local player = getPlayerByName(t[2])
    local waypoint = getWaypointPosition(t[2])
    local tile = string.explode(t[2], ",")
    local pos = {x = 0, y = 0, z = 0}

    if player and (not isPlayerGhost(player) or getPlayerAccess(player) <= getPlayerAccess(cid)) then
        pos = getCreaturePosition(player)
    elseif creature and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerAccess(creature) <= getPlayerAccess(cid))) then
        pos = getCreaturePosition(creature)
    elseif type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0 then
        pos = waypoint
    elseif tile[2] and tile[3] then
        pos = {x = tonumber(tile[1]), y = tonumber(tile[2]), z = tonumber(tile[3])}
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid destination specified.")
        return true
    end

    if not pos or isInArray({pos.x, pos.y}, 0) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
        return true
    end

    pos = getClosestFreeTile(cid, pos)
    if not pos or isInArray({pos.x, pos.y}, 0) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
        return true
    end

    local tmp = getCreaturePosition(pid)
    if doTeleportThing(pid, pos, true) and not isPlayerGhost(pid) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
    end

    return true
end

 

Esse aqui deu erro. mas obg pela tentativa.



 

 

Em 20/07/2023 em 14:56, sverkoa disse:

Eu testei esse script e funcionou bem. Não tenho certeza se o seu TFS 1.3 tem o revscript...

 

local talk = TalkAction("/send", "!send")

function talk.onSay(player, words, param)
    if not player:getGroup():getAccess() then return true end
  local split = param:split(",")
  if split[4] then
    local p = Player(split[1])
    if p then
      p:teleportTo(Position(split[2], split[3], split[4]))
      p:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    end
  end
  return false
end

talk:separator(" ")
talk:register()

exemplo:
/send player name, 33321, 33322, 7

Funcionou certinho aqui !! OBG DE CORAÇÃO ! =)

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo