• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Teleport Scroll (Lower Case or Upper Case)

Extrodus

|| Blazera.net ||
Joined
Dec 22, 2008
Messages
2,691
Solutions
7
Reaction score
549
Location
Canada
Right now I have this script that allows a player to teleport by entering a place in a scroll and clicking ok, but right now it doesnt allow lower case letters if it has a capital at the beginning so I have to make double the locations. Does anyone know a way to make it use lower case and upper case or shorten the script to do for example: "Thais;thais"

Code:
local t = {
["thais"] = {pos = {x = 581, y = 446, z = 7}, storage = 1337, time = 120},
["venore"] = {pos = {x = 834, y = 420, z = 7}, storage = 1337, time = 120},
["Thais"] = {pos = {x = 581, y = 446, z = 7}, storage = 1337, time = 120},
["Venore"] = {pos = {x = 834, y = 420, z = 7}, storage = 1337, time = 120}
}

function onTextEdit(cid, item, newText)
if item.itemid == 1952 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleport Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
end
return true
end

Also when I type in locations and it displays the locations, it sorts them in a very strange way. If anyone could make them display alphabetical or the way listed in config that'd be great but thats not what I really need. The first part of my support request is what I need.
 
Last edited:
Code:
local t = {
["thais"] = {pos = {x = 581, y = 446, z = 7}, storage = 1337, time = 120},
["venore"] = {pos = {x = 834, y = 420, z = 7}, storage = 1337, time = 120},
}

function onTextEdit(cid, item, newText)
    newText = newText:lower()
    if item.itemid == 1952 then
        if isPlayerPzLocked(cid) then
            doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
            return false
        end
        if isInArray({'locations', 'places', 'place'}, newText) then
            local i = ''
            for text, x in pairs(t) do
                i = i .. "\n[" .. text .. "]"
            end

            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleport Locations: " .. i)
        else
            local p = t[newText]
            if not p then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
                return false
            end

            local st = p.storage
            if getCreatureStorage(cid, st) > os.time() then
                doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel again.", TALKTYPE_MONSTER)
                return true
            end

            local ti = p.time
            local pos = p.pos
            doTeleportThing(cid, pos, true)
            doSendMagicEffect(pos, CONST_ME_TELEPORT)
            doCreatureSetStorage(cid, st, os.time() + ti)
            doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
        end
    end
    return true
end
 
@averatec - Dang I edited I figured it out after you posted that. Sorry; yeah I changed the configs to have capitals as soon as I copied it in that's why it stopped working!
 
Back
Top