LU

Pedido Qnd Vip Acaba Sai Promotion

Por LucasCastro, 13 de fev. de 2012 em Archived

script
5
567
LucasCastroL
13 de fevereiro de 2012 às 02:14

O titulo ja dia td.

Qro um script que qnd vip acaba sai promotion.

Qm puder ajudar

Vlws.

;D

VodkartV
13 de fevereiro de 2012 às 09:58

qual seu sistema vip?

LucasCastroL
14 de fevereiro de 2012 às 17:31

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

VodkartV
14 de fevereiro de 2012 às 22:24

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

LucasCastroL
15 de fevereiro de 2012 às 20:27

Muito Obrigado!!

Ajudou Bastante!

 

;D