• 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 1.0, Need help with town portals (script)

Voidactivity

New Member
Joined
Apr 12, 2015
Messages
2
Reaction score
0
Hey, i'm currently using TFS 1. 0 verison for Tbia client v 10.41. I'm at the moment making my own custom map, and want to include town portals which will switch your characters townid (planing to have some major cities) incase they would die. I've been searching around all over the place for a lua script which does this.
Even been trying to make my own script to work with magic fields but can't get it to work.

Help would be much aprecciated.

//Voidactivity
 
This is the code i wrote together. But it doesn't work.
Code:
local town = {}
local destination = {}
local TownPos = {22601}
function onUse(cid, item, itemEx, isHotkey)
    if item.uid > 1000 and item.uid <= 22670 then
        local itemType = ItemType(item.uid)
        local player = Player(cid)
        town[cid] = 2
        destination[cid] = {x = 1019, y = 1061, z = 7}
            if isInArray(TownPos, item.uid) then
                if item.uid == 22601 then
                    player:doPlayerSetTown(cid, town[cid])
                    player:sendTextMessage(MESSAGE_INFO_DESCR, 'You are now resident of Calima ')
                    local destination = destination[cid]
                end
            end
        end
    return true
end
    local function onAddFocus(cid)
    town[cid] = 0
    destination[cid] = 0
    end                   
    local function onReleaseFocus(cid)
    town[cid] = nil
    destination[cid] = nil
end
 
Back
Top