SK
action

promotion

Por sk8sk8ter, 30 de mai. de 2015 em Scripts

script
4
1.3k
sk8sk8terS
30 de maio de 2015 às 01:56

tenho esse item que da vip e promotion epic porem a vip a caba e a promotion não sai tem como resolver

 

aki o escript que fika em actions

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

local config={
removeOnUse = "yes" -- remover quando usar ("yes" or "no")
}

local days = 1 -- dias que serão adicionados
local daysvalue = days * 24 * 60 * 60
local storageplayer = getPlayerStorageValue(cid, 13540)
local timenow = os.time()

if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end
if doPlayerSetPromotionLevel(cid, 2) == 1 or getPlayerVocation(cid) == 5 then
doPlayerSetVocation(cid, 9)
end

if doPlayerSetPromotionLevel(cid, 2) == 2 or getPlayerVocation(cid) == 6 then
doPlayerSetVocation(cid, 10)
end


if doPlayerSetPromotionLevel(cid, 2) == 3 or getPlayerVocation(cid) == 7 then
doPlayerSetVocation(cid, 11)
end

if doPlayerSetPromotionLevel(cid, 2) == 4 or getPlayerVocation(cid) == 8 then
doPlayerSetVocation(cid, 12)
end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 13540, time)
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - 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

 

larissaotsL
30 de maio de 2015 às 21:06

Tente alterando;

doPlayerSetPromotionLevel(cid, 2) == 4

para

if(doPlayerSetPromotionLevel(cid, 2) and ...) then

Espero respostas.

Beijos

sk8sk8terS
30 de maio de 2015 às 21:37

não entendi tem como editar ali pra min ver como fika pq do jeito que colokei não deu não

FurabioF
31 de maio de 2015 às 18:00
Melhor resposta

Troca seu item por esse :

function onUse(cid, item, fromPosition, itemEx, toPosition)

  local days = 30 -- dias que serão adicionados
  local daysvalue = days * 24 * 60 * 60
  local storageplayer = getPlayerStorageValue(cid, 13540)
  local timenow = os.time()

  if getPlayerStorageValue(cid, 13540) - timenow <= 0 then
    time = timenow + daysvalue
  else
    time = storageplayer + daysvalue
  end
  
  if getPlayerVocation(cid) > 4 then
    doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
  end

  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
  setPlayerStorageValue(cid, 13540, time)
  local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
  doSendMagicEffect(getPlayerPosition(cid), math.random(28,30))
  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
  doRemoveItem(item.uid, 1)  
  return true
end

e cria um creature scripts, a tag se faz ai é login(pra remover a vocation quando acabar o vip) :

function onLogin(cid)
  
  if getPlayerStorageValue(cid, 13540) - os.time() <= 0 and getPlayerVocation(cid) > 8 then
    doPlayerSetVocation(cid, getPlayerVocation(cid) - 4)
  end
  
  return true
end