Ir para conteúdo

Featured Replies

Postado

Eu uso esse system de vip por action. Mas gostaria que o player so podesse usar o items novamente quando os dias de vip dele acabar.
Alguem pode ajudar pf.



 

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, 23569)
local timenow = os.time()

if getPlayerStorageValue(cid, 23569) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram Adicionados ".. days .." Dia de Vip Donate no Seu Character.")
setPlayerStorageValue(cid, 23569, time)
local quantity = math.floor((getPlayerStorageValue(cid, 23569) - timenow)/(24 * 60 * 60))
doSendMagicEffect(getPlayerPosition(cid), math.random(30,30)) 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Tem ".. quantity .." Dias de Vip Donate Restantes.")
if (config.removeOnUse == "yes") then
doRemoveItem(item.uid, 1)
end

return TRUE
end
 

 

  • Respostas 12
  • Visualizações 836
  • Created
  • Última resposta

Top Posters In This Topic

Posted Images

Postado

Eu fiz aqui a modificação,teste:
 

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, 23569)
    local timenow = os.time()

    if getPlayerStorageValue(cid, 23569) - os.time() <= 0 then
        time = timenow + daysvalue
    else
        time = storageplayer + daysvalue
    end

    local quantity = math.floor((getPlayerStorageValue(cid, 23569) - timenow)/(24 * 60 * 60))
    
    if(quantity > 0) then {
            doSendMagicEffect(getPlayerPosition(cid), math.random(30,30))
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Tem ".. quantity .." Dias de Vip Donate Restantes.")
    }else{
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram Adicionados ".. days .." Dia de Vip Donate no Seu Character.")
            setPlayerStorageValue(cid, 23569, time)           
        }

    end

    if (config.removeOnUse == "yes") then
        doRemoveItem(item.uid, 1)
    end

    return TRUE
end

 

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Postado
  • Autor
20 minutos atrás, Rayo disse:

Eu fiz aqui a modificação,teste:
 


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, 23569)
    local timenow = os.time()

    if getPlayerStorageValue(cid, 23569) - os.time() <= 0 then
        time = timenow + daysvalue
    else
        time = storageplayer + daysvalue
    end

    local quantity = math.floor((getPlayerStorageValue(cid, 23569) - timenow)/(24 * 60 * 60))
    
    if(quantity > 0) then {
            doSendMagicEffect(getPlayerPosition(cid), math.random(30,30))
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Tem ".. quantity .." Dias de Vip Donate Restantes.")
    }else{
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram Adicionados ".. days .." Dia de Vip Donate no Seu Character.")
            setPlayerStorageValue(cid, 23569, time)           
        }

    end

    if (config.removeOnUse == "yes") then
        doRemoveItem(item.uid, 1)
    end

    return TRUE
end

 

 

Deu o seguinte erro amigo.

 

aaaaaaaaaaaaa.thumb.png.863ed9a2e4d6529520277ea6b625674c.png

Postado
4 minutos atrás, Magalhaes92 disse:

Deu o seguinte erro amigo.

 

aaaaaaaaaaaaa.thumb.png.863ed9a2e4d6529520277ea6b625674c.png

 

Testa agora:

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, 23569)
    local timenow = os.time()
  
    if getPlayerStorageValue(cid, 23569) - os.time() <= 0 then
      time = timenow + daysvalue
    else
      time = storageplayer + daysvalue
    end
  
    local quantity = math.floor((getPlayerStorageValue(cid, 23569) - timenow)/(24 * 60 * 60))
  
    if(quantity > 0) then
      doSendMagicEffect(getPlayerPosition(cid), math.random(30,30))
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Tem ".. quantity .." Dias de Vip Donate Restantes.")
    else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram Adicionados ".. days .." Dia de Vip Donate no Seu Character.")
      setPlayerStorageValue(cid, 23569, time)
  
    end
  
    if (config.removeOnUse == "yes") then
      doRemoveItem(item.uid, 1)
    end
  
    return TRUE
  end

 

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Postado
  • Autor
7 minutos atrás, Rayo disse:

Testa agora:


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, 23569)
    local timenow = os.time()
  
    if getPlayerStorageValue(cid, 23569) - os.time() <= 0 then
      time = timenow + daysvalue
    else
      time = storageplayer + daysvalue
    end
  
    local quantity = math.floor((getPlayerStorageValue(cid, 23569) - timenow)/(24 * 60 * 60))
  
    if(quantity > 0) then
      doSendMagicEffect(getPlayerPosition(cid), math.random(30,30))
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Tem ".. quantity .." Dias de Vip Donate Restantes.")
    else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram Adicionados ".. days .." Dia de Vip Donate no Seu Character.")
      setPlayerStorageValue(cid, 23569, time)
  
    end
  
    if (config.removeOnUse == "yes") then
      doRemoveItem(item.uid, 1)
    end
  
    return TRUE
  end

 

 

Sem erros e funcionando. Porem esta dando pra usar o items quantas vezes quiser.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.8k

Informação Importante

Confirmação de Termo