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

Solved Free Premium

Byte

* * * * *
Joined
Jul 23, 2013
Messages
130
Reaction score
19
Location
???
I need to know how to make every account (including new ones) have free premium(Gratis Premium Account). I can't find anything regarding that in config.lua or anywhere else.

Using OTHire 7.72 and ZnoteACC
 
You can add premium days (with storage so it's only added 1x) in a login script, for example in the first items script or in login.lua.
Code:
doPlayerAddPremiumDays(cid, days)
 
Could you show me how I would add that into my login.lua please? (I'm not very experienced with this)

Here's my login.lua
Code:
function onLogin(cid)
    --Register the kill/die event
    registerCreatureEvent(cid, "RemoveBlesses")

    --Register the Give_Bag_After_Death event
    registerCreatureEvent(cid, "Give_Bag_After_Death")
   
    --Register the Stage event
    if getBooleanFromString(getConfigInfo("experience_stages"), false) then
        registerCreatureEvent(cid, "ExpStage")
        checkStageChange(cid)
    end
    --add a backpack if it is a relogin after a death
    if getPlayerStorageValue(cid, STORAGE_DEATH_BAG) == 1 then
        if getPlayerSlotItem(cid, CONST_SLOT_BACKPACK).uid == 0 then
            local item_bag = doCreateItemEx(ITEM_BAG, 1)
            doPlayerAddItemEx(cid, item_bag, false, CONST_SLOT_BACKPACK)
        end
        setPlayerStorageValue(cid, STORAGE_DEATH_BAG, -1)
    end

    --Remove blesses if necessary
    if getPlayerStorageValue(cid, STORAGE_REMOVE_BLESSES) == 1 then
        local i = 0
        while i < 5 do
            doPlayerRemoveBless(cid, i)
            i = i + 1
        end
        setPlayerStorageValue(cid, STORAGE_REMOVE_BLESSES, -1)
    end

    --Promotes player if necessary
    if(isPremium(cid) ) then
        if(getPlayerStorageValue(cid, STORAGE_PROMOTION) == 1 and getPlayerVocation(cid) <= 4) then
            doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
            doPlayerRemoveSkillLossPercent(cid, 30)
            setPlayerStorageValue(cid, STORAGE_PROMOTION, -1)
        end
        if(getPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT) == 1) then
            setPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT, -1)
        end
        return true
    end

    --Player is not premium - remove premium privileges
    --Change outfit
    if(getPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT) == -1) then
        local lookType = 128
        if(getPlayerSex(cid) == 0) then
            lookType = 136
        end
        local house = House.getHouseByOwner(cid)
        if(house) and getBooleanFromString(getConfigInfo("house_only_premium"), true) then
            house:setOwner(0) --Remove the house from the player, the server takes care of the rest
        end
        doCreatureChangeOutfit(cid, {lookType = lookType, lookHead = 78, lookBody = 69, lookLegs = 97, lookFeet = 95, lookAddons = 0})
        setPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT, 1)
    end



    --Teleport to free town, change here
    --[[
    doPlayerSetTown(cid, Z)
    local masterFreePos = {x=100, y=100, z=7}
    doTeleportThing(cid, masterFreePos)
    ]]-- Hoster's premium towns changes according to the map

    --Remove promotion
    local isPromo = (getPlayerVocation(cid) > 4 and isPremium(cid) == false)
    if(isPromo) then
        doPlayerSetVocation(cid, getPlayerVocation(cid)-4)
        doPlayerRemoveSkillLossPercent(cid, -30)
        setPlayerStorageValue(cid, STORAGE_PROMOTION, 1)
    end

    return true
end
 
Doesn't matter, you can add it anywhere between function onLogin(cid) and return true, as long as it's not in an if statement or for loop.
 
Doesn't matter, you can add it anywhere between function onLogin(cid) and return true, as long as it's not in an if statement or for loop.
Okay So I assume I replace "days" for the amount of days I want them to receive, but what about the storage value. Where does that go?
 
Under onLogin(cid)

PHP:
local config = {str = 1111, days = 365}
if getPlayerStorageValue(cid,config.str) ~= 1 then
doPlayerAddPremiumDays(cid, config.days)
setPlayerStorageValue(cid, config.str, 1)
end
 
Back
Top