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

Vip with 30 days storage

adrianokk

New Member
Joined
Jan 22, 2019
Messages
43
Reaction score
1
I have 2 scripts that are giving vip to the player.
and i need help to fix them

1- Vip through the Store, I edited it a little and left it that.
However it seems that the Storage is not going out alone over time, I need the player to lose the storage after 30 days.
because I'm using the Storage system for doors, floors, Teleports, XP bonos and other things.
Lua:
local a = { DAYS = 30 } -- Dias de Vip

function onSay(cid, words, param, channel)
    if  getPlayerStorageValue(cid, 225501) == 1 then
        return doPlayerSendTextMessage(cid, 20, "Você ja ainda possui VIP Account, espere o termino para ativar novamente!!")
and true
else
    if getPlayerItemCount(cid, 2145) < 15 then
        return doPlayerSendTextMessage(cid, 20, "Voce não tem 15 Gold Bars para realizar a compra.")
and true
end
if getPlayerItemCount(cid, 2145) >= 15 then
    setPlayerStorageValue(cid, 225501, 1)  
    doPlayerAddPremiumDays(cid, a.DAYS)
    doPlayerRemoveItem(cid, 2145, 15)
    doPlayerSendTextMessage(cid, 20, "Voce recebeu "..a.DAYS.." dias de VIP Account!")
    doSendMagicEffect(getCreaturePosition(cid), 28)
return true
end
end
end

2- the Second Script is Vip through an Item.
I also want to put the same storage system that, after 30 days, the storage leaves the player.
But this is a little more confusing. he does not remove the item (17496) after the player uses it.
Lua:
local a = { DAYS = 30 } ---Dias Vip

function onUse (cid, item, frompos, item2, topos, words, param)
    if  getPlayerStorageValue(cid, 225501) == 1 then
        return doPlayerSendTextMessage(cid, 20, "Voce ja ainda possui VIP Account, espere o termino para ativar novamente!!")
and true
end
if setPlayerStorageValue(cid, 225501, 1) then
    doRemoveItem(cid, 17496, 1)
    doPlayerAddPremiumDays(cid, a.DAYS)
    doPlayerSendTextMessage(cid, 20, "Voce ativou 30 dias de VIP Account, com areas exclusiva, +30% EXP e outros beneficios!")
    doSendMagicEffect(getCreaturePosition(cid), 28)
return true
end
end
 
value: os.time() + 30*24*60*60

Lua:
if os.time() > value then
-- free account
else
-- apply vip benefits
end
 
well, if you're using premium days already, you don't need storage

just check if player:getPremiumDays() > 0 instead (it's getPlayerPremiumDays(cid) > 0 for old servers I guess)

Lua:
local a = {
    days = 30, -- Dias de Vip
    itemId = 2145,
    count = 15,
}

function onSay(cid, words, param, channel)
    if getPlayerItemCount(cid, a.itemId) >= a.count then
        if doPlayerRemoveItem(cid, a.itemId, a.count) then
            doPlayerAddPremiumDays(cid, a.days)
            doPlayerSendTextMessage(cid, 20, "Voce recebeu ".. a.days .." dias de VIP Account!")
        end
    else
        doPlayerSendTextMessage(cid, 20, "Voce nao tem " .. a.count .. " Gold Bars para realizar a compra.")
    end

    return true
end
 
Last edited:
mas eu quero adicionar um armazenamento que após 30 dias saia
To update a player's storage value, he must be online.
On login, check if 30 days have passed so you can reset the storage.
To know if 30 days have passed, you will need to do what @zbizu proposed so you are able to know when the 30 days started.
 
Just check premium days in your scripts and you won't need storage

I don't speak pt btw.
 
Last edited:
@zbizu

in case I change
Lua:
if getPlayerStorageValue (cid, 123456) == 1 then
Xp_vip = 3.09
color = 210
tets = "(VIP)"
end

per
Code:
if getPlayerPremiumDays (cid)> = 1 then
Xp_vip = 3.09
color = 210
tets = "(VIP)"
end
Will it work correctly or is it the wrong function?
Post automatically merged:

up
Post automatically merged:

or should I put
Code:
isPremium (cid)
 
Last edited:

Similar threads

Back
Top