local lever = {
[7045] = {30,30,{2160}}
}
function onUse(cid,item,fromPosition,itemEx,toPosition)
if getPoints(cid) < lever[item.actionid][1] then
return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." points.")
end
removePoints(cid,lever[item.actionid][1])
local add = (lever[item.actionid][2]*86400)
setPlayerStorageValue(cid, 85258, getPlayerStorageValue(cid, 85258) - os.time() <= 0 and (os.time() + add) or (getPlayerStorageValue(cid, 85258) + add))
local quantity = math.floor((getPlayerStorageValue(cid, 85258) - os.time())/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
for _, items in pairs(lever[item.actionid][3]) do
doPlayerAddItem(cid,items,1)
end
if not getCreatureName(cid):find('(VIP)') then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
--db.executeQuery("UPDATE `players` SET `name` = '(VIP) "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
--addEvent(doRemoveCreature, 3*1000, cid)
end
return true
end