• 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!

Lua A Teleport script for a GM Island

Atxsu

New Member
Joined
Jun 30, 2022
Messages
11
Reaction score
4
GitHub
sl1ghtly
Hi! I'm trying to make this script work but it always tells me that I am lower than a Game Master even when I am on my god character.

Lua:
local config = {
    minGroupAccess = 4, -- groupid needed
    effectID = CONST_ME_TELEPORT, -- what effect
    positionXYZ = {x=1155,y= 923,z=7} -- where to be teleported to.
    }
    
function onSay(cid,words,param)
    if getPlayerAccess(cid) >= config.minGroupAccess then
        doTeleportThing(cid,config.positionXYZ)
        doSendMagicEffect(config.positionXYZ,config.effectID)
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_RED,'You have been teleported to the GM Island.')
    else
        doPlayerSendCancel(cid,'You cannot use this command if you are lower than a Game Master!')
        doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
    end
    return true
end

I would appreciate any help.

Just to clarify(if it's important), I am on Nekiro's TFS 1.5 downgrade to 8.6.
 
Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    local playerPos = player:getPosition()
    if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
        player:sendCancelMessage("You cannot use this command if you are lower than a Game Master!")
        playerPos:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local positionXYZ = Position(1155, 923, 7)
    player:teleportTo(positionXYZ)
    positionXYZ:sendMagicEffect(CONST_ME_TELEPORT)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "You have been teleported to the GM Island.")
    return true
end
 
Well, my thought process was different. I was thinking "I need a command to teleport game masters and above to a gm island" or something along those lines so the idea had completely slipped through my mind.

However as what you suggested is a good and easier idea, I wouldn't want the town "GM Island" to display on the account maker website. I know that there are probably ways to fix that but it's okay for me with this current one. I appreciate the idea though!
 
You could also use this:
(Revscripts)

Lua:
local createTP = TalkAction("/tp")

function createTP.onSay(player, words, param)
    if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then
        return true
    end
    logCommand(player, words, param)
    if param == "" then
        player:sendCancelMessage("Command param required.")
        return false
    end
    param = param:split(',')
    if param[3] then
        local position = player:getPosition()
        position:getNextPosition(player:getDirection())
        local tp = Game.createItem(1387,1,position)
        if tp then
            tp:setDestination(Position(param[1],param[2], param[3]))
        end
    else
        player:sendCancelMessage("Command example /tp 32420, 32217, 7")
    end
    return false
end

createTP:separator(" ")
createTP:register()
 
You could also use this:
(Revscripts)

Lua:
local createTP = TalkAction("/tp")

function createTP.onSay(player, words, param)
    if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then
        return true
    end
    logCommand(player, words, param)
    if param == "" then
        player:sendCancelMessage("Command param required.")
        return false
    end
    param = param:split(',')
    if param[3] then
        local position = player:getPosition()
        position:getNextPosition(player:getDirection())
        local tp = Game.createItem(1387,1,position)
        if tp then
            tp:setDestination(Position(param[1],param[2], param[3]))
        end
    else
        player:sendCancelMessage("Command example /tp 32420, 32217, 7")
    end
    return false
end

createTP:separator(" ")
createTP:register()
That is a different script. This creates a teleport (item) to a chosen destination.
It is easy to convert the one I posted to revscripts; I just followed the same example he posted and changed old function names to newer ones.
 
That is a different script. This creates a teleport (item) to a chosen destination.
It is easy to convert the one I posted to revscripts; I just followed the same example he posted and changed old function names to newer ones.
Yes, of course! This script would be useful in many other cases, not only to get to GM island
 
Well, my thought process was different. I was thinking "I need a command to teleport game masters and above to a gm island" or something along those lines so the idea had completely slipped through my mind.

However as what you suggested is a good and easier idea, I wouldn't want the town "GM Island" to display on the account maker website. I know that there are probably ways to fix that but it's okay for me with this current one. I appreciate the idea though!
If i remember good on each website on config.php there is a part with each Town , if you dont add Gm Island here with the Town number , players cannot choose it.
 

Similar threads

Back
Top