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

TFS 0.X Team Hunt Lever

Otlandserv

Member
Joined
May 22, 2023
Messages
58
Reaction score
5
Hello,
I need script for teleport players.
If players are in a certain position something like an annihilator they get a teleport but there can be a minimum of 5 and a maximum of 10.
If players stay on location= 1,2,8,10 then TP to position.
Sorry for my english language...
 
Lua:
local config = {
    entry =
    {
        {x = 1001, y = 1001, z = 7},
        {x = 1001, y = 1002, z = 7},
        {x = 1001, y = 1003, z = 7}, -- needs to be at least config.minimum (currently needs 5)
        {x = 1001, y = 1004, z = 7}
    },
    destination =
    {
        {x = 1002, y = 1001, z = 7},
        {x = 1002, y = 1002, z = 7},
        {x = 1002, y = 1003, z = 7}, -- needs to be at least config.maximum (currently needs 10)
        {x = 1002, y = 1004, z = 7}
    },
    minimum = 5,
    maximum = 10
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    local players = {}
    local count = 0
    for _, position in ipairs(config.entry) do
        local pid = getTopCreature(position).uid
        if isPlayer(pid) then
            table.insert(players, pid)
            count = count + 1
        end     
    end
 
    if count < config.minimum or count > config.maximum then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        return true
    end
 
    for i, pid in ipairs(players) do
        doSendMagicEffect(config.entry[i], CONST_ME_POFF)
        doTeleportThing(pid, config.destination[i], false)
        doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
    end
 
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    return true
end
 
Back
Top