what are you trying to do? to tp the player to thais when the premium expires, use the code ninja posted
Actually I had a successful build when I re-installed boost. The code Ninja gave me doesn't work. When I set the premium days to 0 in the database to test it out, the character still remained in darashia. He only lost his promotion. This is my login.lua
function onLogin(cid)
local player = Player(cid)
local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. " Please choose your outfit."
player:sendOutfitWindow()
else
if loginStr ~= "" then
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
end
loginStr = string.format("Your last visit was on %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
end
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
if player:getPremiumDays() > 0 and player:getStorageValue(storageKey, 0) ~= 1 then
player:setStorageValue(storageKey, 1)
elseif player:getPremiumDays() == 0 and player:getStorageValue(storageKey, 1) == 1 then
player:setStorageValue(storageKey, 0)
player:setTown(Town(2)) -- Thais
player:teleportTo(player:getTown():getTemplePosition())
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
player:registerEvent("PlayerDeath")
return true
end