• 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+ Premium players only area (with time check)

Guerra

Member
Joined
May 1, 2018
Messages
69
Reaction score
9
Location
Natal/RN - Brasil
Good night guys, I'm looking to make a city or area where only players with Premium time can stay. With that I would like to ask for help on a script that checks an area and if any player logs in without Premium or his Premium ends and he is in that particular area, he will be sent back to the temple of the city free account.

My TFS Version: 1.3
 
Good night guys, I'm looking to make a city or area where only players with Premium time can stay. With that I would like to ask for help on a script that checks an area and if any player logs in without Premium or his Premium ends and he is in that particular area, he will be sent back to the temple of the city free account.

My TFS Version: 1.3
Try this, I haven't tested it so idk how well it would work. You'll have to adjust the positions to work with your server though.
Lua:
local premiumZone = {
    fromPosition = Position(1000, 1000, 7),
    toPosition = Position(1000, 1000, 7),
}

local freeAccountPosition = Position(1000, 1000, 7)

function Player.checkPremium(self)
    if self:isPremium() then
        local premiumTime = self:getPremiumTime()
        if premiumTime < (24 * 60 * 60) then
            addEvent(function(cid)
                local player = Player(cid)
                if player then
                    player:checkPremium()
                end
            end, premiumTime * 1000 + 1000, self.uid)
        end
    elseif self:getPosition():isInRange(premiumZone.fromPosition, premiumZone.toPosition) then
        self:teleportTo(freeAccountPosition)
        freeAccountPosition:sendMagicEffect(CONST_ME_TELEPORT)
    end
end

function onLogin(player)
    player:checkPremium()
    return true
end
 
Last edited:
Try this, I haven't tested it so idk how well it would work. You'll have to adjust the positions to work with your server though.
Lua:
local premiumZone = {
    fromPosition = Position(1000, 1000, 7),
    toPosition = Position(1000, 1000, 7),
}

local freeAccountPosition = Position(1000, 1000, 7)

function Player.checkPremium(self)
    if self:isPremium() then
        local premiumTime = self:getPremiumTime()
        if premiumTime < (24 * 60 * 60) then
            addEvent(function(cid)
                local player = Player(cid)
                if player then
                    player:checkPremium()
                end
            end, premiumTime * 1000 + 1000, self.uid)
        end
    elseif self:getPosition():isInRange(premiumZone.fromPosition, premiumZone.toPosition) then
        self:teleportTo(freeAccountPosition)
        freeAccountPosition:sendMagicEffect(CONST_ME_TELEPORT)
    end
end

function onLogin(player)
    player:checkPremium()
    return true
end
hi is it possible to work with a UNIQUEID? that expires every 31 days? So the user would buy vip automatically without the need to ask a user, is it also possible to add an extra experience rate just for being in the vip areas?
 
Back
Top