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

When premium end player to back city 1.2

in login.lua add:

Code:
local freeTown = Town(id or name):getTemplePosition() -- edit here town where player should get teleported to
if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    player:teleportTo(freeTown)
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end

in premiumscroll.lua add:

Code:
    player:setStorageValue(998899, 1)

if your OT is already running and already has premium players you have to add storage key: 998899 and value: 1 to them all
 
in login.lua add:

Code:
local freeTown = Town(id or name):getTemplePosition() -- edit here town where player should get teleported to
if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    player:teleportTo(freeTown)
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end

in premiumscroll.lua add:

Code:
    player:setStorageValue(998899, 1)

if your OT is already running and already has premium players you have to add storage key: 998899 and value: 1 to them all

ok thanks but local freeTown = Town(id or name):getTemplePosition()
i like get it from database players = town_id
 
You can get it from map editor CTRL+T
yes but if
player1 create character Town:Venore Town=Venore
player2 create character Town:Thais

Code:
local freeTown = Town(Thais):getTemplePosition() -- edit here town where player should get teleported to
if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    player:teleportTo(freeTown)
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end

so if player1 end premium back to thais (but player1 town is venore not thais)
and player2 end premium back to thais
sorry my bad english but i think you understand me?
 
What if player set town in premium zone?

If you do that he will be teleported to premium zone anyways...


This is what you want, but I don't advise using it if players can set town in premium zone.
Code:
local freeTown = Town(player:getTown()):getTemplePosition() -- edit here town where player should get teleported to
if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    player:teleportTo(freeTown)
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end
 
You can do this, if player set town in premium zone he will be teleported to a default town. If he set home town in free zone he will be teleported home.
Code:
local defaultTown = "Thais" -- default town where player is teleported if his home town is in premium area
local freeTowns = {"Ab'Dendriel", "Carlin", "Kazordoon", "Thais", "Venore"} -- towns in free account area

if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    local town = player:getTown()
    town = isInArray(freeTowns, town:getName()) and town or Town(defaultTown)
    player:teleportTo(town:getTemplePosition())
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end
 
What if player set town in premium zone?

If you do that he will be teleported to premium zone anyways...


This is what you want, but I don't advise using it if players can set town in premium zone.
Code:
local freeTown = Town(player:getTown()):getTemplePosition() -- edit here town where player should get teleported to
if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    player:teleportTo(freeTown)
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end
You can do this, if player set town in premium zone he will be teleported to a default town. If he set home town in free zone he will be teleported home.
Code:
local defaultTown = "Thais" -- default town where player is teleported if his home town is in premium area
local freeTowns = {"Ab'Dendriel", "Carlin", "Kazordoon", "Thais", "Venore"} -- towns in free account area

if player:getPremiumDays() <= 0 and player:getStorageValue(998899) == 1 then
    local town = player:getTown()
    town = isInArray(freeTowns, town:getName()) and town or Town(defaultTown)
    player:teleportTo(town:getTemplePosition())
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
    player:setStorageValue(998899, 0)
end
thanks
 
how i can add 60days premium scroll and 90days premium scrol to this?>
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:setStorageValue(998899, 1)
    player:addPremiumDays(30)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received 30 premium days.")
    item:remove(1)
    return true
end
 
login.lua add:

Have the same problem but im test ur script dont work im modific some optionsand dont work too

1623684172163.png

can help me?

Script:
local defaultTown = "Thais"
local freeTowns = {"Ab'Dendriel", "Carlin", "Kazordoon", "Thais", "Venore"}

if getPlayerPremiumDays() <= 0 and getPlayerStorageValue(998899) == 1 then
local town = getPlayerTown()
town = isInArray(freeTowns, town:getName()) and town or Town(defaultTown)
doPlayerteleportTo(town:getTemplePosition())
doPlayersendTextMessage(MESSAGE_STATUS_WARNING, "Your premium time has expired.")
setPlayerStorageValue(998899, 0)
end

My Version is Forgotten 0.4 - 8.60

Im Put the script on Login.lua of CreatureScripts/scripts/login.lua
 
Back
Top