qual seu sistema vip?
- Forums
- xTibia - Notícias e Suporte
- Soluções
- Archived
- Pedido Qnd Vip Acaba Sai Promotion
info
Group: Herói
Joined: 20/05/10
Posts: 3.4k
Reputation: +1.5k
Gender: Masculino

info
Group: Artesão
Joined: 15/01/12
Posts: 100
Reputation: +9
Tibia Character: Leon Of Pandoria

function onUse(cid, item, fromPosition, itemEx, toPosition)
local config={
removeOnUse = "yes" -- remover quando usar ("yes" or "no")
}
local days = 30 -- dias que serão adicionados
local daysvalue = days * 24 * 60 * 60
local storageplayer = getPlayerStorageValue(cid, 10000)
local timenow = os.time()
if getPlayerStorageValue(cid, 10000) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 10000, time)
local quantity = math.floor((getPlayerStorageValue(cid, 10000) - timenow)/(24 * 60 * 60))
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
if (config.removeOnUse == "yes") then
doRemoveItem(item.uid, 1)
end
return TRUE
end
info
Group: Herói
Joined: 20/05/10
Posts: 3.4k
Reputation: +1.5k
Gender: Masculino

vai em creaturescript/script/login.lua antes do último return TRUE adc isso:
if getPlayerStorageValue(cid, 10000) - os.time() <= 0 and (isInArray({5, 6, 7, 8}, getPlayerVocation(cid))) then -- id das voc promotion
doPlayerSetVocation(cid,getPlayerVocation(cid)-4)
end
isso vai fazer com que o jogador perca a promotion...
tbm dá pra fazer qndo ele for vip ganhar/perder a promotion automaticamente,ai fica assim:
if getPlayerStorageValue(cid, 10000) - os.time() <= 0 and (isInArray({5, 6, 7, 8}, getPlayerVocation(cid))) then -- id das voc promotion
doPlayerSetVocation(cid,getPlayerVocation(cid)-4) -- aqui ele vai perde promotion
elseif getPlayerStorageValue(cid, 10000) - os.time() >= 1 and (isInArray({1, 2, 3, 4}, getPlayerVocation(cid))) then
doPlayerSetVocation(cid,getPlayerVocation(cid)+4) -- aqui ele ganha promotion
end
info
Group: Artesão
Joined: 15/01/12
Posts: 100
Reputation: +9
Tibia Character: Leon Of Pandoria

Muito Obrigado!!
Ajudou Bastante!
;D


info
Group: Artesão
Joined: 15/01/12
Posts: 100
Reputation: +9
Tibia Character: Leon Of Pandoria
O titulo ja dia td.
Qro um script que qnd vip acaba sai promotion.
Qm puder ajudar
Vlws.
;D