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

Citizen Bridge

Margolin

עם ישראל חי
Joined
Dec 20, 2016
Messages
43
Reaction score
12
Hello OTLand can anybody help me to create a script?

It's very simple, it's a bridge you can cross if you are citizen. If not teleport back to certain position.

Something like the Rookgaard bridge.

Thanks
 
Of course you can use your own actionId's

Lua:
local config = {
-- bridgeActionID | townID | kickPosition
    [0001] = {tid = 1, position = Position(1001, 1001, 7)},
    [0002] = {tid = 2, position = Position(1002, 1002, 7)},
    [0003] = {tid = 2, position = Position(1003, 1003, 7)},
    [0004] = {tid = 3, position = Position(1004, 1004, 7)},
    [0005] = {tid = 4, position = Position(1005, 1005, 7)}
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local townId = config[item.actionid]
    if not townId then
        return true
    end

    local town = Town(townId.tid)
    if not town then
        return true
    end
 
    if player:getTown() ~= town then
        player:teleportTo(townId.position)
        townId.position:sendMagicEffect(CONST_ME_TELEPORT)
        player:sendCancelMessage("You can't blaballablalblalblalba.")
    end
    return true
end
or lazy script fromPos:
Lua:
local config = {
-- bridgeActionID | townID
    [0001] = 1,
    [0002] = 2,
    [0003] = 3,
    [0004] = 4,
    [0005] = 5
}
function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local townId = config[item.actionid]
    if not townId then
        return true
    end

    local town = Town(townId)
    if not town then
        return true
    end
 
    if player:getTown() ~= town then
        player:teleportTo(fromPosition)
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
        player:sendCancelMessage("You can't blaballablalblalblalba.")
    end
    return true
end

XML:
    <movevent event="StepIn" fromaid="0001" toaid="0005" script="ScriptName.lua" />
 
Last edited:
Back
Top