• 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.X+ Lua script help 1.2

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
My map have 3 towns
Town id (Inferno) = id 1
Town id (Isle) =id 2
Town ( Jungle ) =id 3



LUA:
if player:isPremium() then
        player:setStorageValue(1000, 1)
    elseif player:getStorageValue(1000) == 1 then
        player:setStorageValue(1000, 0)
        player:teleportTo({x = 201, y = 241, z = 7})
        player:setTown(Town("Jungle"))
    end

In case (elseif) of this script, how to do this only work if the player have town 1 or 2 in database?
 
LUA:
--[[
Town id (Inferno) = id 1
Town id (Isle) =id 2
Town ( Jungle ) =id 3
]]

local townNames = {
    ["Inferno"] = {id = 1, destination = {x = 0, y = 0, z = 0} },
    ["Isle"] = {id = 2, destination = {x = 0, y = 0, z = 0} },
    ["Jungle"] = {id = 3, destination = {x = 201, y = 241, z = 7} }
}
local premStorage = 1000

if player:isPremium() then
    player:setStorageValue(premStorage, 1)
end

if player:getStorageValue(premStorage) == 1 then
    player:setStorageValue(premStorage, 0)
    player:teleportTo(townNames["Jungle"].destination)
    player:setTown(Town(townNames["Jungle"].id))
end
There are easier ways to do this but I think this is what you are trying to achieve.
 
Back
Top