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

-

If you just want it to teleport the player when time runs out then this will work...

Code:
function onLogin(cid)
local storage_has_been_teleported = 25007
local give_first_premium = 25008
local templePos = getTownTemplePosition(getPlayerTown(cid))



    if(isPremium(cid) == false) then
        if getPlayerStorageValue(cid, give_first_premium) ~= 1 then
            doPlayerAddPremiumDays(cid, 7)
            setPlayerStorageValue(cid, give_first_premium, 1)
        return false
        end
        if getPlayerStorageValue(cid, storage_has_been_teleported) ~= 1 then
            doTeleportThing(cid, templePos)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are no longer premium.")
            setPlayerStorageValue(cid, storage_has_been_teleported, 1)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have " ..getPlayerPremiumDays(cid).. " premium days left.")
        if getPlayerStorageValue(cid, storage_has_been_teleported) == 1 then
            setPlayerStorageValue(cid, storage_has_been_teleported, 0)
        end
end
return true
end
 
The script you had was saying: if the player isn't premium set storage to prepair id....which means the next time they log they get 7 days... It was just repeating that over and over...

if isPremium(cid) == false then
setPlayerStorageValue(cid, storage_7_days, prepareID

that part inparticular was screwing your script.
 
The easiest way for me would be to edit your database...

In the accounts add a new value called freeVIP

then this would be your script.
Code:
function getPlayerFreeVIP(cid)
local Info = db.getResult("SELECT `freeVIP` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local value= Info:getDataInt('freeVIP')
Info:free()
return value
end
return LUA_ERROR
end

function doPlayerAddFreeVip(cid)
db.executeQuery("UPDATE `accounts` SET `freeVIP` = 1 WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end


function onLogin(cid)
local storage_has_been_teleported = 25007
local templePos = getTownTemplePosition(getPlayerTown(cid))



    if(isPremium(cid) == false) then
        if getPlayerFreeVIP(cid) ~= 1 then
            doPlayerAddPremiumDays(cid, 7)
            doPlayerAddFreeVip(cid)
        return false
        end
        if getPlayerStorageValue(cid, storage_has_been_teleported) ~= 1 then
            doTeleportThing(cid, templePos)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are no longer premium.")
            setPlayerStorageValue(cid, storage_has_been_teleported, 1)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have " ..getPlayerPremiumDays(cid).. " premium days left.")
        if getPlayerStorageValue(cid, storage_has_been_teleported) == 1 then
            setPlayerStorageValue(cid, storage_has_been_teleported, 0)
        end
end
return true
end
 
To be honest there should be a place in your config.lua that allows you to edit in how many days of premium a new account starts with.
 
This is without the return false

Code:
function getPlayerFreeVIP(cid)
local Info = db.getResult("SELECT `freeVIP` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local value= Info:getDataInt('freeVIP')
Info:free()
return value
end
return LUA_ERROR
end

function doPlayerAddFreeVip(cid)
db.executeQuery("UPDATE `accounts` SET `freeVIP` = 1 WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end


function onLogin(cid)
local storage_has_been_teleported = 25007
local give_first_premium = 25008
local templePos = getTownTemplePosition(getPlayerTown(cid))



    if(isPremium(cid) == false) then
        if getPlayerFreeVIP(cid) ~= 1 then
            doPlayerAddPremiumDays(cid, 7)
            doPlayerAddFreeVip(cid)
        else
        if getPlayerStorageValue(cid, storage_has_been_teleported) ~= 1 then
            doTeleportThing(cid, templePos)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are no longer premium.")
            setPlayerStorageValue(cid, storage_has_been_teleported, 1)
        end
    end
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have " ..getPlayerPremiumDays(cid).. " premium days left.")
        if getPlayerStorageValue(cid, storage_has_been_teleported) == 1 then
            setPlayerStorageValue(cid, storage_has_been_teleported, 0)
        end
end
return true
end
 
Back
Top