Untitled
local teleportToPos = TalkAction("/tpos") function teleportToPos.onSay(player, words, param) if not player:getGroup():getAccess() then player:sendCancelMessage("You don't have the required access to use this command.") return false end local params = param:split(" ") if #params ~= 3 then player:sendCancelMessage("Usage: /tpos x y z") return false end local x = tonumber(params[1]) local y = tonumber(params[2]) local z = tonumber(params[3]) if not x or not y or not z then player:sendCancelMessage("Usage: /tpos x y z") return false end local targetPosition = Position(x, y, z) local teleport = player:teleportTo(targetPosition) if not teleport then player:sendCancelMessage("Invalid destination.") return false else targetPosition:sendMagicEffect(CONST_ME_TELEPORT) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Teleported to x" .. targetPosition.x .. " y" .. targetPosition.y .. " z" .. targetPosition.z .. ".") end return true end teleportToPos:separator(" ") teleportToPos:register()
Leave a Comment