• 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 0.X Vip Scroll - Increasing days

potinho

Active Member
Joined
Oct 11, 2009
Messages
395
Solutions
11
Reaction score
37
Location
Brazil
Hello guys, I have a question: I have a functional script to add VIP days to a player, but when I use it I would like the days to be really added when I use a scroll, as it is, it is just replacing. If I use a 30 day scroll today and tomorrow I use a 10 day scroll, I would like to keep 40 days, but the 10 scroll replaces the 30 scroll. Could you help me?

Follow my VIP Scroll code:

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT por 30 dias!")
        setPlayerStorageValue(cid, 30009, os.time() + 30 * 24 * 60 * 60)
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)
    end

    return true
end
 
Solution
Hello guys, I have a question: I have a functional script to add VIP days to a player, but when I use it I would like the days to be really added when I use a scroll, as it is, it is just replacing. If I use a 30 day scroll today and tomorrow I use a 10 day scroll, I would like to keep 40 days, but the 10 scroll replaces the 30 scroll. Could you help me?

Follow my VIP Scroll code:

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT por 30 dias!")
        setPlayerStorageValue(cid, 30009, os.time() + 30 * 24 * 60 * 60)
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)...

mackerel

Well-Known Member
Joined
Apr 26, 2017
Messages
399
Solutions
18
Reaction score
71
Hello guys, I have a question: I have a functional script to add VIP days to a player, but when I use it I would like the days to be really added when I use a scroll, as it is, it is just replacing. If I use a 30 day scroll today and tomorrow I use a 10 day scroll, I would like to keep 40 days, but the 10 scroll replaces the 30 scroll. Could you help me?

Follow my VIP Scroll code:

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT por 30 dias!")
        setPlayerStorageValue(cid, 30009, os.time() + 30 * 24 * 60 * 60)
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)
    end

    return true
end
This should work :)

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT por 30 dias!")
        local val = getPlayerStorageValue(cid, 30009)
        setPlayerStorageValue(cid, 30009, os.time() + val + (30 * 24 * 60 * 60))
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)
    end

    return true
end
 
OP
OP
potinho

potinho

Active Member
Joined
Oct 11, 2009
Messages
395
Solutions
11
Reaction score
37
Location
Brazil
This should work :)

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT por 30 dias!")
        local val = getPlayerStorageValue(cid, 30009)
        setPlayerStorageValue(cid, 30009, os.time() + val + (30 * 24 * 60 * 60))
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)
    end

    return true
end
Thanks for u reply, but added some years in value storage haha

My value storage jump 1609613651 (january 2, 2021) to 3755439651 (january 1, 2089).
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,610
Solutions
395
Reaction score
3,724
Hello guys, I have a question: I have a functional script to add VIP days to a player, but when I use it I would like the days to be really added when I use a scroll, as it is, it is just replacing. If I use a 30 day scroll today and tomorrow I use a 10 day scroll, I would like to keep 40 days, but the 10 scroll replaces the 30 scroll. Could you help me?

Follow my VIP Scroll code:

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT por 30 dias!")
        setPlayerStorageValue(cid, 30009, os.time() + 30 * 24 * 60 * 60)
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)
    end

    return true
end
Lua:
local vipStorage = 30009
local vipDays = 10

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local currentTime, vipStorageValue = os.time(), getPlayerStorageValue(cid, vipStorage)
    setPlayerStorageValue(cid, vipStorage, (vipStorageValue < currentTime and currentTime or vipStorageValue) + (60 * 60 * 24 * vipDays))
    -- doPlayerAddPremiumDays(cid, 7) -- not sure why you're adding premium days with a vip scroll
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you've added " .. vipDays .. " to this account!")
    doRemoveItem(item.uid, 1)
    return true
end
 
Solution
OP
OP
potinho

potinho

Active Member
Joined
Oct 11, 2009
Messages
395
Solutions
11
Reaction score
37
Location
Brazil
Lua:
local vipStorage = 30009
local vipDays = 10

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local currentTime, vipStorageValue = os.time(), getPlayerStorageValue(cid, vipStorage)
    setPlayerStorageValue(cid, vipStorage, (vipStorageValue < currentTime and currentTime or vipStorageValue) + (60 * 60 * 24 * vipDays))
    -- doPlayerAddPremiumDays(cid, 7) -- not sure why you're adding premium days with a vip scroll
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you've added " .. vipDays .. " to this account!")
    doRemoveItem(item.uid, 1)
    return true
end
Worked Xikini, thank you very much
 
Top