• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
script create tp in game  1.5

script create tp in game 1.5 Tfs 1.5

No permission to download
script create tp in game
/tp 2993, 3113, 7
LUA:
local createTP = TalkAction("/tp")

function string:split(sep)
    local result = {}
    for match in (self .. sep):gmatch("(.-)" .. sep) do
        table.insert(result, match)
    end
    return result
end

function string:trim()
    return self:match("^%s*(.-)%s*$")
end

local function getNextPosition(position, direction)
    local nextPos = Position(position)
    if direction == DIRECTION_NORTH then
        nextPos.y = nextPos.y - 1
    elseif direction == DIRECTION_EAST then
        nextPos.x = nextPos.x + 1
    elseif direction == DIRECTION_SOUTH then
        nextPos.y = nextPos.y + 1
    elseif direction == DIRECTION_WEST then
        nextPos.x = nextPos.x - 1
    end
    return nextPos
end

function createTP.onSay(player, words, param)
    if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then
        return true
    end

    if param:trim() == "" then
        player:sendCancelMessage("Command param required.")
        return false
    end

    local params = param:split(',')
    if #params == 3 then
        local x = tonumber(params[1]:trim())
        local y = tonumber(params[2]:trim())
        local z = tonumber(params[3]:trim())
        
        if x and y and z then
            local playerPos = player:getPosition()
            local directionPos = getNextPosition(playerPos, player:getDirection())
            local tp = Game.createItem(1387, 1, directionPos)
            if tp then
                tp:setDestination(Position(x, y, z))
                player:sendTextMessage(MESSAGE_INFO_DESCR, "Teleport created to position (" .. x .. ", " .. y .. ", " .. z .. ").")
            else
                player:sendCancelMessage("Failed to create teleport.")
            end
        else
            player:sendCancelMessage("Invalid coordinates. Use: /tp 2993, 3113, 7")
        end
    else
        player:sendCancelMessage("Command example: /tp 2993, 3113, 7")
    end
    return false
end

createTP:separator(" ")
createTP:register()


Tp.png
  • Like
Reactions: Madusa
Author
abdala ragab
Downloads
6
Views
1,051
First release
Last update

Ratings

5.00 star(s) 2 ratings

More resources from abdala ragab

Latest reviews

Thanks for script works very well for me
Very Very cool thank you
Back
Top